
package com.insigma.business.qrcode.soldier._provider.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

import com.insigma.business.qrcode.common.dao.CommonAdminAreaDO;
import com.insigma.business.qrcode.common.dto.ErrorCodeEnum;
import com.insigma.business.qrcode.common.dto.HealthTypeEnum;
import com.insigma.business.qrcode.common.dto.SoldierTypeEnum;
import com.insigma.business.qrcode.common.converter.SoldierBasicInfoProviderConverter;
import com.insigma.business.qrcode.common._provider.CommonAdminAreaProvider;
import com.insigma.business.qrcode.common.service.CommonAdminAreaService;
import com.insigma.business.qrcode.common.service.GovOrgService;
import com.insigma.business.qrcode.common.service.SequenceGenerator;
import com.insigma.business.qrcode.common.template.BasePagingResponse;
import com.insigma.business.qrcode.common.util.*;
import com.insigma.business.qrcode.common.util.BizCheckUtil;
import com.insigma.business.qrcode.common.util.PdfUtils;
import com.insigma.business.qrcode.common.util.ResponseUtils;
import com.insigma.business.qrcode.common.vo.BaseDeleteRequest;
import com.insigma.business.qrcode.common.vo.BaseResponse;
import com.insigma.business.qrcode.common.vo.ProcessStatusEnum;
import com.insigma.business.qrcode.common.vo.UserTypeEnum;
import com.insigma.business.qrcode.soldier._provider.CommonAuthInfoProvider;
import com.insigma.business.qrcode.soldier._provider.SoldierApplyInfoProvider;
import com.insigma.business.qrcode.soldier._provider.SoldierBasicInfoProvider;
import com.insigma.business.qrcode.soldier.dao.BasicInformationDAO;
import com.insigma.business.qrcode.soldier.dao.DimGjjdlkDocDao;
import com.insigma.business.qrcode.soldier.dao.JdlkInfoBasicinfoDao;
import com.insigma.business.qrcode.soldier.dao.SoldierEducationInfoDao;
import com.insigma.business.qrcode.soldier.dto.*;
import com.insigma.business.qrcode.soldier.dto.HealthStatsDTO;
import com.insigma.business.qrcode.soldier.dto.SoldierBasicInfoBSearcher;
import com.insigma.business.qrcode.soldier.dto.SoldierBasicInfoDTO;
import com.insigma.business.qrcode.soldier.dto.SystemConfigService;
import com.insigma.business.qrcode.soldier.dto.gov.BaseProviderImpl;
import com.insigma.business.qrcode.common.template.area.ScenarioCodeEnum;
import com.insigma.business.qrcode.common.template.area.ServiceCallback;
import com.insigma.business.qrcode.soldier.entity.*;
import com.insigma.business.qrcode.soldier.request.*;
import com.insigma.business.qrcode.soldier.service.*;
import com.insigma.business.qrcode.soldier.service.impl.SoldierBasicRefresher;
import com.insigma.business.qrcode.soldier.service.impl.SoldierExtraInfoRefresher;
import com.insigma.business.qrcode.soldier.service.impl.SoldierExtraMaxCountInterfaceRefresher;
import com.insigma.business.qrcode.soldier.service.impl.StableThirdPartyRefresher;
import com.insigma.business.qrcode.soldier.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.dom4j.DocumentException;
import org.slf4j.MDC;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import java.io.InputStream;
import java.net.URL;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;


@Slf4j
@Service
@Component("soldierBasicInfoProvider")
public class SoldierBasicInfoProviderImpl extends BaseProviderImpl implements SoldierBasicInfoProvider {

    @Value("${sm.tmp.dir}")
    private String tmpDir;

    @Autowired
    private SystemConfigService systemConfigService;

    @Autowired
    private SoldierBasicInfoService soldierBasicInfoService;

    @Autowired
    private ThirdPartyService thirdPartyService;

    @Autowired(required = false)
    private SoldierEducationInfoDao soldierEducationInfoDao;

    @Autowired
    private CommonAdminAreaService commonAdminAreaService;

    @Autowired(required = false)
    private SequenceGenerator sequenceGenerator;

    @Autowired(required = false)
    private SoldierHouseholdRegistrationInfoService soldierHouseholdRegistrationInfoService;

    @Autowired
    private SoldierHouseInfoService soldierHouseInfoService;

    @Autowired
    private RedisLock redisLock;

    @Autowired
    private StableThirdPartyRefresher stableThirdPartyRefresher;

    @Autowired
    private SoldierBasicImportService soldierBasicImportService;

    @Autowired
    private CommonAdminAreaProvider commonAdminAreaProvider;

    @Autowired
    private SoldierApplyInfoProvider soldierApplyInfoProvider;

    @Autowired
    private SoldierApplyInfoService soldierApplyInfoService;

    @Autowired
    private SoldierTypeService soldierTypeService;

    @Autowired
    private SoldierLabelInfoService soldierLabelInfoService;

    @Autowired
    private SoldierBasicRefresher soldierBasicRefresher;

    @Autowired
    @Lazy
    private SoldierExtraInfoRefresher soldierExtraInfoRefresher;

    @Autowired
    private SoldierExtraMaxCountInterfaceRefresher soldierExtraMaxCountInterfaceRefresher;

    @Autowired
    private SoldierTpAllService soldierTpAllService;

    @Autowired
    private GovOrgService govOrgService;

    @Autowired
    private MiniCacheUtils miniCacheUtils;

    @Autowired
    private CommonTmpInfoService commonTmpInfoService;

    @Autowired
    private SoldierBasicModifyRecordService soldierBasicModifyRecordService;

    @Autowired
    private CommonAuthInfoProvider commonAuthInfoProvider;

    @Autowired
    private SoldierDifficultyRegistrationInfoService soldierDifficultyRegistrationInfoService;

    @Autowired
    private SoldierUnemploymentRegistrationInfoService soldierUnemploymentRegistrationInfoService;

    @Autowired
    DimGjjdlkDocDao dimGjjdlkDocDao;


    @Autowired
    JdlkInfoBasicinfoDao jdlkInfoBasicinfoDao;
    @Autowired
    private SyfxtService syfxtService;

    @Autowired
    private IrsService irsService;

    @Autowired
    private RedisUtils redisUtils;


    @Value("${oss.proxy}")
    private String imgBaseUrl;

    @Value("${h5.jx.base.url}")
    private String jxBaseUrl;

    @Autowired
    private PrivacyEncComponent privacyEncComponent;

    @Resource
    private BasicInformationDAO basicInformationDAO;


    @Override
    public BaseResponse<HealthStatsDTO> statsHealth(SoldierBasicInfoSearchRequest searchRequest) {

        BizCheckUtil.checkNotBlank(searchRequest.getAdminAreaCode(), "地区码不能为空");
        String cutdAreaCode = AdminAreaCodeUtils.getCutdAreaCode(searchRequest.getAdminAreaCode());

        if (Strings.isBlank(searchRequest.getSoldierType())) {
            searchRequest.setSoldierType(null);
        }

        SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = new SoldierBasicInfoBSearcher(1, Integer.MAX_VALUE);
        soldierBasicInfoBSearcher.setAdminAreaCode(cutdAreaCode);
        soldierBasicInfoBSearcher.setSoldierType(searchRequest.getSoldierType());
        Integer integer = soldierBasicInfoService.count(soldierBasicInfoBSearcher);

        soldierBasicInfoBSearcher.setHealthStatus(HealthTypeEnum.HEALTH.name());
        Integer count = soldierBasicInfoService.count(soldierBasicInfoBSearcher);

        soldierBasicInfoBSearcher.setHealthStatus(HealthTypeEnum.ILL.name());
        Integer count2 = soldierBasicInfoService.count(soldierBasicInfoBSearcher);

        HealthStatsDTO resultObject = new HealthStatsDTO(integer, count, count2);

        List<DataStatsCDO> statsCDOS = soldierBasicInfoService.listAgeRange3(cutdAreaCode + "%", searchRequest.getSoldierType());
        Map<String, Integer> collect = statsCDOS.stream().collect(Collectors.toMap(s -> s.getItemCNName(), s -> s.getItemCount()));
        resultObject.setNum0_60(nullIntegerTo0(collect.get("60以下")));
        resultObject.setNum60_80(nullIntegerTo0(collect.get("60-80")));
        resultObject.setNum80_100(nullIntegerTo0(collect.get("80-100")));
        resultObject.setNumBg100(nullIntegerTo0(collect.get("100以上")));

        return ResponseUtils.buildSuccessResponse(resultObject);
    }

    private int nullIntegerTo0(Integer i) {
        if (i == null) {
            return 0;
        }
        return i;
    }


    @Override
    public BasePagingResponse<List<SoldierBasicInfoDTO>> searchSoldierBasicInfo(final SoldierBasicInfoSearchRequest searchRequest) {

        final BasePagingResponse<List<SoldierBasicInfoDTO>> basePagingResponse = new BasePagingResponse<>();
        serviceTemplate.execute(basePagingResponse, new ServiceCallback() {
            @Override
            public void check() {
                BizCheckUtil.checkNotNull(searchRequest, "查询分页SoldierBasicInfo的请求参数不能为空");
            }

            @Override
            public void executeService() {
                final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = convertSearcher(searchRequest);

                final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.search(soldierBasicInfoBSearcher);
                final List<SoldierBasicInfoDTO> soldierBasicInfoDTOList = SoldierBasicInfoProviderConverter.convertResponseDOList2DTOList(soldierBasicInfoDOList);
                Set<String> lowSideSet = miniCacheUtils.getCachedLowSideSet();
                Set<String> subsistenceAllowanceSet = miniCacheUtils.getCachedSubsistenceAllowanceSet();
                Set<String> extremelyPoorSet = miniCacheUtils.getCachedExtremelyPoorSet();

                if (!CollectionUtils.isEmpty(soldierBasicInfoDTOList)) {
                    for (SoldierBasicInfoDTO basicInfoDTO : soldierBasicInfoDTOList) {
                        List<String> dy = new ArrayList<>();
                        if (lowSideSet.contains(basicInfoDTO.getIdCardNo())) {
                            dy.add("低边");
                        }
                        if (subsistenceAllowanceSet.contains(basicInfoDTO.getIdCardNo())) {
                            dy.add("低保");
                        }
                        if (extremelyPoorSet.contains(basicInfoDTO.getIdCardNo())) {
                            dy.add("特困");
                        }
                        basicInfoDTO.setDifficultyType(String.join(",", dy));


                        if (Strings.isNotBlank(basicInfoDTO.getResidentAddress())) {
                            String address = basicInfoDTO.getResidentAddress().replace(",", "").replace("/", "")
                                    .replace("浙江省", "").replace("浙江", "");
                            if (!address.contains("杭州")) {
                                address = "杭州市" + address;
                            }
                            basicInfoDTO.setResidentAddress(address);
                        }
                    }
                }

                ResponseUtils.buildSuccessPagingResponse(basePagingResponse, soldierBasicInfoDTOList, searchRequest, soldierBasicInfoBSearcher.getTotalCount());
            }

            @Override
            public ScenarioCodeEnum getScenarioEnum() {
                return ScenarioCodeEnum.SOLDIER_BASIC_INFO_SEARCH;
            }
        });

        return basePagingResponse;
    }

    private SoldierBasicInfoBSearcher convertSearcher(SoldierBasicInfoSearchRequest searchRequest) {
        GovOrgDO cachedGovOfEmployee = miniCacheUtils.getCachedGovOfEmployee(searchRequest.getEmployeeId());
        if (GovTypeEnum.ARMY.name().equals(cachedGovOfEmployee.getType())) {
            searchRequest.setServiceStationId(cachedGovOfEmployee.getId());
            searchRequest.setAdminAreaCode(null);
        }
        searchRequest.setIdCardNo(Strings.isBlank(searchRequest.getIdCardNo()) ? null : searchRequest.getIdCardNo().trim());
        searchRequest.setRealName(Strings.isBlank(searchRequest.getRealName()) ? null : searchRequest.getRealName().trim());
        searchRequest.setSortKeyValueJoint("id_desc");

        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(searchRequest);

        String adminAreaCode = soldierBasicInfoBSearcher.getAdminAreaCode();
        if (Strings.isNotBlank(adminAreaCode)) {
            soldierBasicInfoBSearcher.setAdminAreaCode(AdminAreaCodeUtils.getCutdAreaCode(adminAreaCode));
        }
        return soldierBasicInfoBSearcher;
    }

    @Override
    public BaseResponse<SoldierBasicInfoDTO> getSoldierBasicInfoByCard(String idCardNo) {
        BizCheckUtil.checkIDCardNO(idCardNo);

        SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);

        ThreadPoolManager.getInstance().execute(new Runnable() {
            @Override
            public void run() {
                checkAndSetAvatarPath(soldierBasicInfoDO);
            }
        });

        SoldierBasicInfoDTO soldierBasicInfoDTO = SoldierBasicInfoProviderConverter.convertResponseDO2DTO(soldierBasicInfoDO);
        if (soldierBasicInfoDTO == null) {
            return new BaseResponse<>(true, soldierBasicInfoDTO);
        }


        int warningLevel = 0;
        List<SoldierDifficultyRegistrationInfoDO> umemploymentInfo = soldierDifficultyRegistrationInfoService.getByIdCardNo(soldierBasicInfoDTO.getIdCardNo());
        if (!CollectionUtils.isEmpty(umemploymentInfo)) {
            warningLevel++;
        }
        List<SoldierUnemploymentRegistrationInfoDO> difficultyInfo = soldierUnemploymentRegistrationInfoService.getByIdCardNo(soldierBasicInfoDTO.getIdCardNo());
        if (!CollectionUtils.isEmpty(difficultyInfo)) {
            warningLevel++;
        }
        soldierBasicInfoDTO.setWarningLevel(String.valueOf(warningLevel));
        return new BaseResponse<>(true, soldierBasicInfoDTO);
    }

    private void checkAndSetAvatarPath(SoldierBasicInfoDO soldierBasicInfoDO) {
        if (soldierBasicInfoDO == null) {
            return;
        }

        if (Strings.isBlank(soldierBasicInfoDO.getAvatarPath())) {
            Future<String> future = ThreadPoolManager.getInstance().submit(new Callable<String>() {
                @Override
                public String call() throws Exception {
                    try {
                        ElectronicLicense electronicLicense = thirdPartyService.queryElectronicLicense(soldierBasicInfoDO.getIdCardNo());
                        if (electronicLicense != null) {
                            String fileUrl = electronicLicense.getFileurl();
                            if (Strings.isNotBlank(fileUrl)) {
                                String ossAvatarPath = PdfUtils.extractImageFromPathToOss(fileUrl, soldierBasicInfoDO.getIdCardNo(), tmpDir);
                                if (Strings.isNotBlank(ossAvatarPath)) {
                                    soldierBasicInfoDO.setAvatarPath(ossAvatarPath);
                                    soldierBasicInfoDO.setAvatarPathUp(ossAvatarPath);
                                    soldierBasicInfoService.update(soldierBasicInfoDO);

                                }
                            }
                        }
                        List<DeadInfoEntity> deadInfoEntities = irsService.queryDeadInfo(soldierBasicInfoDO.getIdCardNo());
                        if (!CollectionUtils.isEmpty(deadInfoEntities)) {
                            soldierBasicInfoDO.setDead(true);
                            soldierBasicInfoDO.setDeadInfo(deadInfoEntities.get(0).getVC_AZJSWJB1());
                            soldierBasicInfoService.update(soldierBasicInfoDO);
                        }

                    } catch (Exception e) {
                        log.error("query electric error:{}", e);
                    }
                    return null;
                }
            });

            try {
                future.get(5, TimeUnit.SECONDS);
            } catch (Exception e) {
                log.error("get异常", e);
            }
        }
    }

    @Override
    public BaseResponse<SoldierBasicInfoDTO> getSoldierBasicInfoByCard(String idCardNo, String name) {
        SoldierBasicInfoDO soldierBasicInfoByCard = soldierBasicInfoService.getSoldierBasicInfoByCard(idCardNo, name);
        if (soldierBasicInfoByCard == null) {
            return ResponseUtils.buildSuccessResponse(null);
        }
        SoldierBasicInfoDTO soldierBasicInfoDTO = SoldierBasicInfoProviderConverter.convertResponseDO2DTO(soldierBasicInfoByCard);
        String residentAdminAreaCode = soldierBasicInfoByCard.getResidentAdminAreaCode();
        CommonAdminAreaDO commonAdminAreaDO = commonAdminAreaService.get(residentAdminAreaCode);
        soldierBasicInfoDTO.setAdminAreaFullPath(commonAdminAreaDO.getFullValuePath());
        return ResponseUtils.buildSuccessResponse(soldierBasicInfoDTO);
    }

    @Override
    public BaseResponse<List<SoldierBasicInfoDTO>> listSoldierBasicInfoByCard(String condition, String adminAreaCode) {
        List<SoldierBasicInfoDO> soldierBasicInfoDOS = soldierBasicInfoService.listSoldierBasicInfoByNameOfArea(condition, adminAreaCode);
        if (CollectionUtils.isEmpty(soldierBasicInfoDOS)) {
            return ResponseUtils.buildSuccessResponse(new ArrayList<>());
        }

        List<SoldierBasicInfoDTO> soldierBasicInfoDTOS = SoldierBasicInfoProviderConverter.convertResponseDOList2DTOList(soldierBasicInfoDOS);
        return ResponseUtils.buildSuccessResponse(soldierBasicInfoDTOS);
    }


    @Override
    public BaseResponse<SoldierBasicInfoDTO> getSoldierBasicInfo(final BaseGetRequest baseGetRequest) {

        final BaseResponse<SoldierBasicInfoDTO> baseResponse = new BaseResponse<>();
        serviceTemplate.execute(baseResponse, new ServiceCallback() {
            @Override
            public void check() {
                BizCheckUtil.checkNotNull(baseGetRequest, "获取单条SoldierBasicInfo的请求参数不能为空");
                BizCheckUtil.checkNotBlank((String) baseGetRequest.getId(), "id不能为空");
            }

            @Override
            public void executeService() {
                final SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.get((String) baseGetRequest.getId());
                checkAndSetAvatarPath(soldierBasicInfoDO);
                final SoldierBasicInfoDTO remoteObj = SoldierBasicInfoProviderConverter.convertResponseDO2DTO(soldierBasicInfoDO);
                ResponseUtils.setupSuccessResponse(baseResponse, remoteObj);
            }

            @Override
            public ScenarioCodeEnum getScenarioEnum() {
                return ScenarioCodeEnum.SOLDIER_BASIC_INFO_GET;
            }
        });
        return baseResponse;
    }

    @Override
    public BaseResponse<SoldierBasicInfoDTO> getSoldierBasicInfoBySoldierId(String soldierId) {
        BizCheckUtil.checkNotNull(soldierId);
        SoldierBasicInfoDO basicInfoDO = soldierBasicInfoService.getByQrSuccess(soldierId);
        SoldierBasicInfoDTO soldierBasicInfoDTO = SoldierBasicInfoProviderConverter.
                convertResponseDO2DTO(basicInfoDO);

        return ResponseUtils.buildSuccessResponse(soldierBasicInfoDTO);
    }

    @Override
    public BaseResponse<SoldierBasicCheckInfoDTO> checkIsSoldier(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");

        SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByIdCardNo(idCardNo);
        if (byIdCardNo == null) {
            return ResponseUtils.buildSuccessResponse(new SoldierBasicCheckInfoDTO(false));
        } else {
            SoldierBasicCheckInfoDTO soldierBasicCheckInfoDTO = new SoldierBasicCheckInfoDTO(true);
            soldierBasicCheckInfoDTO.setIsQrSucc(Strings.isNotBlank(byIdCardNo.getSoldierId()));
            soldierBasicCheckInfoDTO.setIdCardNo(byIdCardNo.getIdCardNo());
            soldierBasicCheckInfoDTO.setRealName(byIdCardNo.getRealName());
            soldierBasicCheckInfoDTO.setMobile(byIdCardNo.getMobile());
            soldierBasicCheckInfoDTO.setSoldierType(byIdCardNo.getSoldierType());
            soldierBasicCheckInfoDTO.setResidentAdminAreaCode(byIdCardNo.getResidentAdminAreaCode());
            Boolean westLakePreTreatment = soldierBasicInfoService.isKeyPreTreatment(byIdCardNo.getIdCardNo());
            soldierBasicCheckInfoDTO.setKeyPreTreatment(westLakePreTreatment);
            return ResponseUtils.buildSuccessResponse(soldierBasicCheckInfoDTO);
        }
    }

    @Override
    public BaseResponse<SoldierBasicCheckInfoDTO> checkIsSoldierByMobile(String mobile) {

        BizCheckUtil.checkNotBlank(mobile, "手机号不能为空");

        SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByMobile(mobile);
        if (byIdCardNo == null) {
            return ResponseUtils.buildSuccessResponse(new SoldierBasicCheckInfoDTO(false));
        } else {
            SoldierBasicCheckInfoDTO soldierBasicCheckInfoDTO = new SoldierBasicCheckInfoDTO(true);
            soldierBasicCheckInfoDTO.setIdCardNo(byIdCardNo.getIdCardNo());
            soldierBasicCheckInfoDTO.setRealName(byIdCardNo.getRealName());
            soldierBasicCheckInfoDTO.setMobile(byIdCardNo.getMobile());
            soldierBasicCheckInfoDTO.setSoldierType(byIdCardNo.getSoldierType());
            Boolean westLakePreTreatment = soldierBasicInfoService.isKeyPreTreatment(byIdCardNo.getIdCardNo());
            soldierBasicCheckInfoDTO.setKeyPreTreatment(westLakePreTreatment);
            return ResponseUtils.buildSuccessResponse(soldierBasicCheckInfoDTO);
        }
    }


    @Transactional
    @Override
    public BaseResponse<String> insertSoldierBasicInfo(final SoldierBasicInfoInsertRequest insertRequest) {

        final BaseResponse<String> baseResponse = new BaseResponse<>();
        serviceTemplate.execute(transactionTemplate, baseResponse, new ServiceCallback() {
            @Override
            public void check() {
                BizCheckUtil.checkNotNull(insertRequest, "新增SoldierBasicInfo的请求参数不能为空");
            }

            @Override
            public void executeService() {
                final SoldierBasicInfoDO soldierBasicInfoDO = SoldierBasicInfoProviderConverter.convertRequestIO2DO(insertRequest);
                soldierBasicInfoService.insert(soldierBasicInfoDO);
                ResponseUtils.setupSuccessResponse(baseResponse, soldierBasicInfoDO.getId());
            }

            @Override
            public ScenarioCodeEnum getScenarioEnum() {
                return ScenarioCodeEnum.SOLDIER_BASIC_INFO_INSERT;
            }
        });
        return baseResponse;
    }


    @Override
    public BaseResponse<Integer> updateSoldierBasicInfo(final SoldierBasicInfoUpdateRequest updateRequest) {

        final BaseResponse<Integer> baseResponse = new BaseResponse<>();
        serviceTemplate.execute(transactionTemplate, baseResponse, new ServiceCallback() {
            @Override
            public void check() {
                BizCheckUtil.checkNotNull(updateRequest, "修改SoldierBasicInfo的请求参数不能为空");
                BizCheckUtil.checkNotBlank(updateRequest.getId(), "id不能为空");
                BizCheckUtil.checkNotBlank(updateRequest.getModifierId(), "操作人不能为空");
                BizCheckUtil.checkNotBlank(updateRequest.getModifierType(), "操作人类型不能为空");
            }

            @Override
            public void executeService() {
                SoldierBasicInfoDO soldierBasicInfoDO = SoldierBasicInfoProviderConverter.convertRequestUO2DO(updateRequest);
                Integer affectRowNum = soldierBasicInfoService.update(soldierBasicInfoDO);
                ResponseUtils.setupSuccessResponse(baseResponse, affectRowNum);
            }

            @Override
            public ScenarioCodeEnum getScenarioEnum() {
                return ScenarioCodeEnum.SOLDIER_BASIC_INFO_UPDATE;
            }
        });
        return baseResponse;
    }


    @Transactional
    @Override
    public BaseResponse<Integer> deleteSoldierBasicInfo(final BaseDeleteRequest deleteRequest) {


        BizCheckUtil.checkNotNull(deleteRequest, "逻辑删除SoldierBasicInfo的请求参数不能为空");
        BizCheckUtil.checkNotBlank((String) deleteRequest.getId(), "id不能为空");
        BizCheckUtil.checkNotBlank(deleteRequest.getModifierType(), "操作人类型不能为空");
        BizCheckUtil.checkNotBlank((String) deleteRequest.getModifierId(), "操作人不能为空");

        SoldierBasicInfoDO basicInfoDO = soldierBasicInfoService.get((String) deleteRequest.getId());
        BizCheckUtil.checkNotNull(basicInfoDO, "查无此人");
        final Integer affectRowNum = soldierBasicInfoService.delete((String) deleteRequest.getId(), deleteRequest.getModifierType(), (String) deleteRequest.getModifierId());
        final Integer affectRowNum2 = soldierApplyInfoService.deleteByIdCardNo(basicInfoDO.getIdCardNo(), deleteRequest.getModifierType(), (String) deleteRequest.getModifierId());

        return ResponseUtils.buildSuccessResponse(affectRowNum);
    }

    @Override
    public BaseResponse<String> editBasicInfo(SoldierBasicEditRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotBlank(request.getSoldierId(), "soldierId不能为空");

        SoldierBasicInfoDO bySoldierId = soldierBasicInfoService.getBySoldierId(request.getSoldierId());
        BizCheckUtil.checkNotNull(bySoldierId, "查无此人");

        if (Strings.isNotBlank(request.getResidentAddress())) {
            bySoldierId.setResidentAddress(request.getResidentAddress());
        }
        if (Strings.isNotBlank(request.getMobile())) {
            bySoldierId.setMobile(request.getMobile());
        }

        if (Strings.isNotBlank(request.getAvatarPath())) {
            bySoldierId.setAvatarPath(request.getAvatarPath());
        }

        bySoldierId.setModifierId(request.getSoldierId());
        soldierBasicInfoService.update(bySoldierId);

        return ResponseUtils.buildSuccessResponse("success");
    }

    @Override
    public BaseResponse<Integer> updateBasicInfoOfYryd(SoldierBasicInfoUpdateRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotNull(request.getIdCardNo(), "请求不能为空");

        SoldierBasicInfoDO basicInfo = soldierBasicInfoService.getByIdCardNo(request.getIdCardNo());
        BizCheckUtil.checkNotNull(basicInfo, "查无此人");

        if (Strings.isNotBlank(request.getResidentAddress())) {
            insertModifyRecord(basicInfo, "地址", basicInfo.getResidentAddress(), request.getResidentAddress(), request.getModifierId(), request.getModifierType());
            basicInfo.setResidentAddress(request.getResidentAddress());
        }
        if (Strings.isNotBlank(request.getResidentAdminAreaCode())) {
            insertModifyRecord(basicInfo, "行政区划", basicInfo.getResidentAdminAreaCode(), request.getResidentAdminAreaCode(), request.getModifierId(), request.getModifierType());
            basicInfo.setResidentAdminAreaCode(request.getResidentAdminAreaCode());
        }
        if (Strings.isNotBlank(request.getMobile())) {
            insertModifyRecord(basicInfo, "手机号", basicInfo.getMobile(), request.getMobile(), request.getModifierId(), request.getModifierType());
            basicInfo.setMobile(request.getMobile());
        }
        if (Strings.isNotBlank(request.getAvatarPath())) {
            insertModifyRecord(basicInfo, "头像", basicInfo.getAvatarPath(), request.getAvatarPath(), request.getModifierId(), request.getModifierType());
            basicInfo.setAvatarPath(request.getAvatarPath());
        }
        if (Strings.isNotBlank(request.getRealName())) {
            insertModifyRecord(basicInfo, "姓名", basicInfo.getRealName(), request.getRealName(), request.getModifierId(), request.getModifierType());
            basicInfo.setRealName(request.getRealName());
        }
        if (Strings.isNotBlank(request.getGender())) {
            insertModifyRecord(basicInfo, "性别", basicInfo.getGender(), request.getGender(), request.getModifierId(), request.getModifierType());
            basicInfo.setGender(request.getGender());
        }
        if (Strings.isNotBlank(request.getNation())) {
            insertModifyRecord(basicInfo, "民族", basicInfo.getNation(), request.getNation(), request.getModifierId(), request.getModifierType());
            basicInfo.setNation(request.getNation());
        }
        if (Strings.isNotBlank(request.getMaritalStatus())) {
            insertModifyRecord(basicInfo, "婚姻状况", basicInfo.getMaritalStatus(), request.getMaritalStatus(), request.getModifierId(), request.getModifierType());
            basicInfo.setMaritalStatus(request.getMaritalStatus());
        }
        if (Strings.isNotBlank(request.getEducationLevel())) {
            insertModifyRecord(basicInfo, "学历", basicInfo.getEducationLevel(), request.getEducationLevel(), request.getModifierId(), request.getModifierType());
            basicInfo.setEducationLevel(request.getEducationLevel());
        }
        if (Strings.isNotBlank(request.getHouseholdRegisterType())) {
            insertModifyRecord(basicInfo, "户口类型", basicInfo.getHouseholdRegisterType(), request.getHouseholdRegisterType(), request.getModifierId(), request.getModifierType());
            basicInfo.setHouseholdRegisterType(request.getHouseholdRegisterType());
        }
        if (Strings.isNotBlank(request.getPoliticalOutlook())) {
            insertModifyRecord(basicInfo, "政治面貌", basicInfo.getPoliticalOutlook(), request.getPoliticalOutlook(), request.getModifierId(), request.getModifierType());
            basicInfo.setPoliticalOutlook(request.getPoliticalOutlook());
        }
        if (Strings.isNotBlank(request.getSoldierType())) {
            insertModifyRecord(basicInfo, "退役军人类型", basicInfo.getSoldierType(), request.getSoldierType(), request.getModifierId(), request.getModifierType());
            basicInfo.setSoldierType(request.getSoldierType());
        }
        if (Strings.isNotBlank(request.getSoldierTypeDictCode())) {
            basicInfo.setSoldierTypeDictCode(request.getSoldierTypeDictCode());
        }
        if (Strings.isNotBlank(request.getLabels())) {
            insertModifyRecord(basicInfo, "标签", basicInfo.getLabels(), request.getLabels(), request.getModifierId(), request.getModifierType());
            basicInfo.setLabels(request.getLabels());
        }
        if (Strings.isNotBlank(request.getRemark())) {
            insertModifyRecord(basicInfo, "备注", basicInfo.getRemark(), request.getRemark(), request.getModifierId(), request.getModifierType());
            basicInfo.setRemark(request.getRemark());
        }
        if (Strings.isNotBlank(request.getAttachment())) {

            basicInfo.setAttachment(request.getAttachment());
        }
        if (request.getBirthday() != null) {
            insertModifyRecord(basicInfo, "生日", objectToString(basicInfo.getBirthday()), objectToString(request.getBirthday()), request.getModifierId(), request.getModifierType());
            basicInfo.setBirthday(request.getBirthday());
        }
        if (request.getEntryDatetime() != null) {
            insertModifyRecord(basicInfo, "入伍时间", objectToString(basicInfo.getEntryDatetime()), objectToString(request.getEntryDatetime()), request.getModifierId(), request.getModifierType());
            basicInfo.setEntryDatetime(request.getEntryDatetime());
        }
        if (request.getRetireDatetime() != null) {
            insertModifyRecord(basicInfo, "退伍时间", objectToString(basicInfo.getRetireDatetime()), objectToString(request.getRetireDatetime()), request.getModifierId(), request.getModifierType());
            basicInfo.setRetireDatetime(request.getRetireDatetime());
        }

        basicInfo.setModifierId(request.getModifierId());
        basicInfo.setModifierType(request.getModifierType());
        Integer update = soldierBasicInfoService.update(basicInfo);
        return ResponseUtils.buildSuccessResponse(update);
    }

    private String objectToString(Object o) {
        if (o == null) {
            return null;
        }
        return String.valueOf(o);
    }

    private void insertModifyRecord(SoldierBasicInfoDO basicInfo, String domain, String origin, String target, String creatorId, String creatorType) {
        if ((origin == null && target == null) || (origin != null && origin.equals(target))) {
            return;
        }

        SoldierBasicModifyRecordDO recordDO = new SoldierBasicModifyRecordDO();
        recordDO.setSoldierId(basicInfo.getSoldierId());
        recordDO.setIdCardNo(basicInfo.getIdCardNo());
        recordDO.setRealName(basicInfo.getRealName());
        recordDO.setDomain(domain);
        recordDO.setOriginalValue(origin);
        recordDO.setTargetValue(target);
        recordDO.setDetail(domain + "从 " + origin + " 修改为 " + target + " ");
        recordDO.setCreatorId(creatorId);
        recordDO.setCreatorType(creatorType);
        recordDO.setCreateDatetime(new Date());
        try {
            soldierBasicModifyRecordService.insert(recordDO);
        } catch (Exception e) {
            log.error("修改报错错误{}", e);
        }
    }

    @Override
    public BasePagingResponse<List<SoldierBasicShortInfoDTO>> searchPreferentialTreatment(SoldierBasicInfoSearchRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");

        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(request);
        final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.searchPreferentialTreatment(soldierBasicInfoBSearcher);

        final List<SoldierBasicShortInfoDTO> soldierBasicInfoDTOList = Lists.newArrayList();
        if (!CollectionUtils.isEmpty(soldierBasicInfoDOList)) {
            for (SoldierBasicInfoDO soldierBasicInfoDO : soldierBasicInfoDOList) {
                SoldierBasicShortInfoDTO dto = new SoldierBasicShortInfoDTO();
                dto.setIdCardNo(soldierBasicInfoDO.getIdCardNo());
                dto.setRealName(soldierBasicInfoDO.getRealName());
                dto.setSoldierId(soldierBasicInfoDO.getSoldierId());
                dto.setSoldierType(soldierBasicInfoDO.getSoldierType());
                soldierBasicInfoDTOList.add(dto);
            }
        }

        return ResponseUtils.buildSuccessPagingResponse(soldierBasicInfoDTOList, soldierBasicInfoBSearcher);
    }

    private boolean isNowXihuEnjoyWeek() {
        SystemConfigDO configDO = systemConfigService.getByName("XH_AUTO_ENJOY_WEEK");
        BizCheckUtil.checkNotNull(configDO);
        String[] split = configDO.getValue().split(",");
        DateTime startTime = DateUtil.parse(split[0], "yyyy-MM-dd HH:mm:ss");
        DateTime endTime = DateUtil.parse(split[1], "yyyy-MM-dd HH:mm:ss");
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis > startTime.getTime() && currentTimeMillis < endTime.getTime()) {
            return true;
        }
        return false;
    }

    @Override
    public BaseResponse<SoldierBasicShortInfoDTO> getSoldierShortInfo(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "请求不能为空");

        SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByIdCardNo(idCardNo);
        if (byIdCardNo == null) {

            if (isNowXihuEnjoyWeek()) {
                SoldierApplyInfoDO applyInfoDO = soldierApplyInfoService.getByIdCardNoOfType(idCardNo, null);
                if (applyInfoDO != null) {
                    SoldierBasicInfoDO byQrSuccess = soldierBasicInfoService.getByQrSuccess(applyInfoDO.getSoldierId());
                    if (byQrSuccess != null) {
                        SoldierBasicShortInfoDTO shortInfoDTO = new SoldierBasicShortInfoDTO();
                        shortInfoDTO.setRealName(byQrSuccess.getRealName());
                        shortInfoDTO.setIdCardNo(byQrSuccess.getIdCardNo());
                        shortInfoDTO.setAvatarPath(convertImgPath(byQrSuccess.getAvatarPath()));
                        shortInfoDTO.setMobile(byQrSuccess.getMobile());
                        shortInfoDTO.setSoldierType(byQrSuccess.getSoldierType());

                        shortInfoDTO.setIsWestLakePreTreatment(true);
                        return ResponseUtils.buildSuccessResponse(shortInfoDTO);
                    }
                }
            }

            return ResponseUtils.buildSuccessResponse(null);
        }

        SoldierBasicShortInfoDTO shortInfoDTO = new SoldierBasicShortInfoDTO();
        shortInfoDTO.setRealName(byIdCardNo.getRealName());
        shortInfoDTO.setIdCardNo(byIdCardNo.getIdCardNo());
        shortInfoDTO.setAvatarPath(convertImgPath(byIdCardNo.getAvatarPath()));
        shortInfoDTO.setMobile(byIdCardNo.getMobile());
        shortInfoDTO.setSoldierType(byIdCardNo.getSoldierType());

        shortInfoDTO.setIsWestLakePreTreatment(soldierBasicInfoService.isWestLakePreTreatment(idCardNo));
        return ResponseUtils.buildSuccessResponse(shortInfoDTO);
    }

    private String convertImgPath(String avatarPath) {
        if (Strings.isBlank(avatarPath)) {
            return "";
        }
        if (avatarPath.toLowerCase().startsWith("http")) {
            return avatarPath;
        }
        return imgBaseUrl + "/" + avatarPath;
    }

    @Override
    public BasePagingResponse<List<SoldierBasicShortInfoDTO>> searchAreaSoldierShortList(SoldierBasicInfoSearchRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotNull(request.getAdminAreaCode(), "地区不能为空");

        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(request);
        final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.searchAreaSoldierShortList(soldierBasicInfoBSearcher);

        List<SoldierBasicShortInfoDTO> list = convertSoldierShortDTO(soldierBasicInfoDOList);
        return ResponseUtils.buildSuccessPagingResponse(list, soldierBasicInfoBSearcher);
    }

    private List<SoldierBasicShortInfoDTO> convertSoldierShortDTO(List<SoldierBasicInfoDO> soldierBasicInfoDOList) {
        List<SoldierBasicShortInfoDTO> list = Lists.newArrayList();
        if (!CollectionUtils.isEmpty(soldierBasicInfoDOList)) {
            for (SoldierBasicInfoDO basicInfoDO : soldierBasicInfoDOList) {
                SoldierBasicShortInfoDTO ss = new SoldierBasicShortInfoDTO();
                ss.setId(basicInfoDO.getId());
                ss.setRealName(basicInfoDO.getRealName());
                list.add(ss);
            }
        }
        return list;
    }

    @Override
    public BaseResponse<String> insertAllSoldier(SimpleApiRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotNull(request.getUrl(), "url不能为空");
        BizCheckUtil.checkNotNull(request.getEmployeeId(), "用户不能为空");
        GovOrgDO govOfEmploy = govOrgService.getGovOfEmploy(request.getEmployeeId());
        String adminAreaCode = govOfEmploy.getLeafAdminAreaId();

        try {
            String url = request.getUrl();
            url = url.replace("115.227.32.11", "172.18.102.62");
            URL source = new URL(url);
            InputStream inputStream = source.openStream();
            ExcelReader reader = ExcelUtil.getReader(inputStream);

            final List<List<Object>> read = reader.read();
            String[] strings = {"行政区划", "姓名", "性别", "民族", "出生日期", "身份证号", "人员类别", "户籍类别",
                    "户籍地", "政治面貌", "文化程度", "家庭住址", "婚姻状况", "现工作单位", "联系电话", "采集人", "采集单位"};
            checkSoldierImportTemplate(read.get(0), strings);

            ThreadPoolManager.getInstance().submit(new Runnable() {
                @Override
                public void run() {
                    try {
                        List<List<Object>> list = read.subList(1, read.size());

                        for (List<Object> objects : list) {
                            for (int i = objects.size(); i < strings.length; i++) {
                                objects.add(null);
                            }
                        }

                        for (List<Object> objects : list) {
                            String zxqh = (String) objects.get(0);
                            String name = (String) objects.get(1);
                            String gender = (String) objects.get(2);
                            String nation = (String) objects.get(3);
                            String birthdayStr = (String) objects.get(4);
                            String idCardNo = (String) objects.get(5);
                            String soldierType = (String) objects.get(6);
                            String household = (String) objects.get(7);
                            String rootAdmin = (String) objects.get(8);
                            String political = (String) objects.get(9);
                            String education = (String) objects.get(10);
                            String address = (String) objects.get(11);
                            String marry = (String) objects.get(12);
                            String nowWork = (String) objects.get(13);
                            String mobile = (String) objects.get(14);
                            String collector = (String) objects.get(15);
                            String collectUnit = (String) objects.get(16);

                            if (Strings.isBlank(idCardNo) || Strings.isBlank(name)) {
                                continue;
                            }
                            SoldierBasicInfoDO uniSoldier = soldierBasicInfoService.getByIdCardNo(idCardNo);

                            if (uniSoldier == null) {
                                uniSoldier = new SoldierBasicInfoDO();
                                uniSoldier.setIdCardNo(idCardNo);
                                uniSoldier.setRealName(name);
                                uniSoldier.setNation(nation);
                                uniSoldier.setGender(buildGender(gender));
                                uniSoldier.setBirthday(stringToDate(birthdayStr));
                                uniSoldier.setRootAdminAreaValue(rootAdmin);
                                uniSoldier.setResidentAddress(address);
                                uniSoldier.setSoldierType(optSoldierType(soldierType));
                                uniSoldier.setSoldierTypeDictCode(getSoldierTypeCodes(soldierType));
                                uniSoldier.setHouseholdRegisterType(buildHouseHold(household));
                                uniSoldier.setEducationLevel(buildEdu(education));
                                uniSoldier.setPoliticalOutlook(political);
                                uniSoldier.setNowWorkUnit(nowWork);
                                uniSoldier.setMaritalStatus(marry);
                                uniSoldier.setCollector(collector);
                                uniSoldier.setCollectionUnit(collectUnit);
                                uniSoldier.setDeleted(false);
                                uniSoldier.setMobile(mobile);
                                String residentAdminAreaCode = commonAdminAreaProvider.analyseAreaCodeByBasicInfo(zxqh);
                                uniSoldier.setResidentAdminAreaCode(getCorrectAdminCode(residentAdminAreaCode, adminAreaCode));
                                uniSoldier.setServiceStationId(govOfEmploy.getId());
                                uniSoldier.setCreatorId(request.getCreatorId());
                                uniSoldier.setCreatorType(UserTypeEnum.GOV_EMPLOYEE.name());
                                soldierBasicInfoService.insert(uniSoldier);

                                if (Strings.isNotBlank(uniSoldier.getSoldierType())) {
                                    for (String st : uniSoldier.getSoldierType().split(",")) {
                                        SoldierTypeDO typeDO = new SoldierTypeDO();
                                        typeDO.setSoldierId(uniSoldier.getId());
                                        typeDO.setSoldierType(st);
                                        typeDO.setAdminAreaCode(uniSoldier.getResidentAdminAreaCode());
                                        soldierTypeService.insert(typeDO);
                                    }
                                }
                            }


                            SoldierApplyInfoDO applyInfoDO = soldierApplyInfoService.getByIdCardNo(uniSoldier.getIdCardNo());
                            if (applyInfoDO != null && !applyInfoDO.getStatus().equals("SUCCESS")) {
                                if (applyInfoDO.getStatus().equals("REJECT")) {
                                    applyInfoDO.setStatus("DEALING");
                                    soldierApplyInfoService.update(applyInfoDO);
                                }
                                SoldierApplyInfoInsertRequest request = new SoldierApplyInfoInsertRequest();
                                request.setId(applyInfoDO.getId());
                                request.setCondition("0");
                                request.setComment("<系统自动通过，已经采集入库>" + applyInfoDO.getComment());
                                soldierApplyInfoProvider.completeTask(request);
                            }
                        }
                    } catch (Exception e) {
                        log.error("导入错误：{}", e);
                    }
                }
            });

        } catch (BizException e) {
            log.error("导入数据发生异常", e);
            throw e;
        } catch (Exception e) {
            log.error("导入数据发生异常", e);
            throw new BizException(ErrorCodeEnum.ILLEGAL_PARAM);
        }
        return ResponseUtils.buildSuccessResponse("处理中");
    }

    private String buildGender(String gender) {
        if (Strings.isBlank(gender)) {
            return null;
        }

        return gender.startsWith("男") ? "MALE" : "FEMALE";
    }

    private String buildEdu(String education) {
        if (Strings.isBlank(education)) {
            return null;
        }

        if (education.contains("大学专科和专科学校")) {
            return "大学专科";
        }

        return education;
    }

    private String buildHouseHold(String household) {
        if (Strings.isBlank(household)) {
            return null;
        }
        if (household.contains("城镇")) {
            return "城镇（非农业）";
        }
        return "农村（农业）";
    }

    private String getCorrectAdminCode(String calCode, String oriCode) {
        if (Strings.isBlank(calCode)) {
            return oriCode;
        }

        boolean b = AdminAreaCodeUtils.checkIsFatherArea(calCode, oriCode);
        if (b) {
            return oriCode;
        }

        if (AdminAreaCodeUtils.checkIsFatherArea(oriCode, calCode)) {
            return calCode;
        }

        return oriCode;
    }

    private void checkSoldierImportTemplate(List<Object> headers, String... names) {
        for (int i = 0; i < names.length; i++) {
            BizCheckUtil.checkIsTrue(((String) headers.get(i)).startsWith(names[i]), "模板错误");
        }
    }

    @Override
    public BasePagingResponse<List<SoldierBasicShortInfoDTO>> searchAreaDifficultySoldierShortList(SoldierBasicInfoSearchRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotNull(request.getAdminAreaCode(), "地区不能为空");
        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(request);
        final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.searchAreaDifficultySoldierShortList(soldierBasicInfoBSearcher);

        List<SoldierBasicShortInfoDTO> list = convertSoldierShortDTO(soldierBasicInfoDOList);
        return ResponseUtils.buildSuccessPagingResponse(list, soldierBasicInfoBSearcher);
    }

    @Override
    public BasePagingResponse<List<SoldierBasicShortInfoDTO>> searchAreaUnemploymentSoldierShortList(SoldierBasicInfoSearchRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotNull(request.getAdminAreaCode(), "地区不能为空");
        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(request);
        final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.searchAreaUnemploymentSoldierShortList(soldierBasicInfoBSearcher);

        List<SoldierBasicShortInfoDTO> list = convertSoldierShortDTO(soldierBasicInfoDOList);
        return ResponseUtils.buildSuccessPagingResponse(list, soldierBasicInfoBSearcher);
    }

    @Override
    public BaseResponse<String> deleteDeadAndXyjsSoldiers(SimpleApiRequest request) {

        try {
            String url = request.getUrl();
            url = url.replace("115.227.32.11", "172.18.102.62");
            URL source = new URL(url);
            InputStream inputStream = source.openStream();
            ExcelReader reader = ExcelUtil.getReader(inputStream);

            final List<List<Object>> read = reader.read();

            List<Object> objects = read.get(0);
            BizCheckUtil.checkIsTrue(((String) objects.get(0)).startsWith("地区"), "模板错误");
            BizCheckUtil.checkIsTrue(((String) objects.get(1)).startsWith("姓名"), "模板错误");
            BizCheckUtil.checkIsTrue(((String) objects.get(2)).startsWith("身份证"), "模板错误");
            BizCheckUtil.checkIsTrue(((String) objects.get(3)).startsWith("类型"), "模板错误");

            List<List<Object>> list = read.subList(1, read.size());

            for (List<Object> objectList : list) {
                String name = (String) objectList.get(1);
                String dType = (String) objectList.get(3);
                BizCheckUtil.checkIsTrue(dType.equals("死亡") || dType.equals("现役军人家属"), name + ":" + dType + "，类型错误");
            }

            String traceId = MDC.get("traceId");
            ThreadPoolManager.getInstance().submit(new Runnable() {
                @Override
                public void run() {
                    String result = "删除老兵结果：\n";
                    MDC.put("traceId", Strings.isBlank(traceId) ? UUID.randomUUID().toString() : traceId);
                    for (List<Object> objects : list) {
                        log.info("删除老兵：{}", objects);
                        String xzqh = (String) objects.get(0);
                        String name = (String) objects.get(1);
                        String idCardNo = (String) objects.get(2);
                        idCardNo = idCardNo.trim();
                        String dType = (String) objects.get(3);

                        if (Strings.isNotBlank(idCardNo)) {
                            SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByIdCardNo(idCardNo);
                            if (byIdCardNo == null) {
                                log.error("身份证不存在：{}, name:{}", idCardNo, name);
                                result += addResultStr("身份证不存在", name, idCardNo);
                            } else {
                                String s = deleteByType(dType, byIdCardNo);
                                result += addResultStr(s, name, idCardNo);
                            }
                            continue;
                        }

                        String areaCode = commonAdminAreaProvider.analyseAreaCodeByBasicInfo(xzqh);
                        List<SoldierBasicInfoDO> soldierBasicInfoDOS = soldierBasicInfoService.listByNameAndAdminAreaCode(name.trim(), areaCode);
                        if (!CollectionUtils.isEmpty(soldierBasicInfoDOS) && soldierBasicInfoDOS.size() == 1) {
                            SoldierBasicInfoDO byIdCardNo = soldierBasicInfoDOS.get(0);
                            String s = deleteByType(dType, byIdCardNo);
                            result += addResultStr(s, name, idCardNo);
                        } else if (!CollectionUtils.isEmpty(soldierBasicInfoDOS)) {
                            log.error("重名,{},{},{}", xzqh, name, dType);
                            result += addResultStr("重名", name, idCardNo);
                        } else {
                            log.error("不存在,{},{},{}", xzqh, name, dType);
                            result += addResultStr("不存在", name, idCardNo);
                        }
                    }
                    log.info("{}", result);
                }
            });

        } catch (BizException e) {
            log.error("导入数据发生异常", e);
            throw e;
        } catch (Exception e) {
            log.error("导入数据发生异常", e);
            throw new BizException(ErrorCodeEnum.ILLEGAL_PARAM);
        }
        return ResponseUtils.buildSuccessResponse("处理中");
    }

    private String addResultStr(String reason, String name, String idCardNo) {
        return reason + "，姓名：" + name + "，身份证：" + idCardNo + "。\n";
    }

    private String deleteByType(String dType, SoldierBasicInfoDO byIdCardNo) {
        if (dType.equals(SoldierTypeEnum.ACTIVE_SOLDIER_FAMILY_MEMBER.getDesc())) {
            if (byIdCardNo.getSoldierType().contains(dType.trim())) {
                log.info("删除现役家属:{},{}", byIdCardNo.getRealName(), byIdCardNo.getIdCardNo());
                soldierBasicInfoService.delete(byIdCardNo.getId(), "admin", "admin");
                return "删除现役家属";
            }
        } else if ("死亡".equals(dType.trim())) {
            log.info("设置死亡:{},{}", byIdCardNo.getRealName(), byIdCardNo.getIdCardNo());
            soldierBasicInfoService.setSoldierDead(byIdCardNo.getIdCardNo(), byIdCardNo.getDeadInfo());
            return "设置死亡";
        }
        return "参数错误";
    }

    @Override
    public BaseResponse<String> refreshAllBasicInfo(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "请求不能为空");
        String s = soldierBasicRefresher.refreshAllBasicInfo(idCardNo);
        return ResponseUtils.buildSuccessResponse(s);
    }

    @Override
    public BaseResponse<String> refreshAllTpExtraInfo(SoldierRefresherRequest request) {

        soldierExtraInfoRefresher.refreshAllInfo(request);
        return ResponseUtils.buildSuccessResponse("success");
    }


    @Override
    public BaseResponse<String> refreshExtraMaxCountInfo(SoldierRefresherRequest request) {


        soldierExtraMaxCountInterfaceRefresher.refreshMaxCountInterfaceInfo(request);
        return ResponseUtils.buildSuccessResponse("success");
    }

    @Transactional
    @Override
    public BaseResponse<String> updateSoldierExtraInfoByCardNo(SoldierBasicInfoUpdateRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotBlank(request.getIdCardNo(), "身份证不能为空");

        SoldierBasicInfoDO basicInfoDO = soldierBasicInfoService.getByIdCardNo(request.getIdCardNo());
        basicInfoDO.setResidentAddress(request.getResidentAddress());
        basicInfoDO.setMobile(request.getMobile());
        basicInfoDO.setNowWorkUnit(request.getNowWorkUnit());
        basicInfoDO.setEmploymentStatus(request.getEmploymentStatus());
        basicInfoDO.setOrgLife(request.getOrgLife());
        basicInfoDO.setOrgRelationship(request.getOrgRelationship());
        basicInfoDO.setOrgRelationshipUnit(request.getOrgRelationshipUnit());

        if (Strings.isNotBlank(request.getOrgRelationshipUnit())) {
            basicInfoDO.setPoliticalOutlook("中国共产党党员");
        }

        basicInfoDO.setOrgManagementStatus(request.getOrgManagementStatus());
        basicInfoDO.setKeyAppealsPerson(request.getKeyAppealsPerson());
        basicInfoDO.setJoinPartyTime(request.getJoinPartyTime());
        basicInfoDO.setGloryFlag(request.getGloryFlag());
        basicInfoDO.setLabels(request.getLabels());

        basicInfoDO.setCollectorId(request.getCollectorId());
        basicInfoDO.setModifierId(request.getModifierId());
        basicInfoDO.setModifyDatetime(new Date());
        soldierBasicInfoService.update(basicInfoDO);
        soldierLabelInfoService.updateLabels(basicInfoDO.getIdCardNo(), request.getLabels());

        return ResponseUtils.buildSuccessResponse("success");
    }

    @Override
    public BaseResponse<InsuredEntity> queryInsured(String idCardNo) {
        InsuredEntity insuredEntity = thirdPartyService.queryInsured(idCardNo);
        return ResponseUtils.buildSuccessResponse(insuredEntity);
    }

    @Override
    public BaseResponse<InsuredEntity> queryInsuredByConvert(String idCardNo, String realName) {
        BizCheckUtil.checkNotBlank(idCardNo, "身份证不能为空");

        List<SocialSecurityEntity> dto = irsService.querySocialSecurity(idCardNo, realName);
        if (!CollectionUtils.isEmpty(dto)) {
            SocialSecurityEntity socialSecurityEntity = dto.get(0);
            InsuredEntity entity = new InsuredEntity();
            entity.setXm(socialSecurityEntity.getAac003());
            entity.setSfzh(socialSecurityEntity.getAac147());
            entity.setDwmc(socialSecurityEntity.getAab004());
            entity.setYbkh(socialSecurityEntity.getAac001());
            entity.setSccbrq(socialSecurityEntity.getAae030());
            String aac031 = socialSecurityEntity.getAac031();
            if ("1".equals(aac031)) {
                entity.setYbzxbz("参保缴费");
                entity.setYbzxbzCode(SocialSecurityStatusEnum.INSURED.name());
            } else if ("2".equals(aac031)) {
                entity.setYbzxbz("暂停缴费");
                entity.setYbzxbzCode(SocialSecurityStatusEnum.PAUSE.name());
            } else if ("3".equals(aac031)) {
                entity.setYbzxbz("终止缴费");
                entity.setYbzxbzCode(SocialSecurityStatusEnum.TERMINATION.name());
            } else {
                entity.setYbzxbz("");
            }
            entity.setGwybz(getGwybz(dto));
            entity.setLastPayTime(socialSecurityEntity.getTongTime());
            return ResponseUtils.buildSuccessResponse(entity);
        }
        return ResponseUtils.buildSuccessResponse(new InsuredEntity());
    }

    @Override
    public BaseResponse<InsuredEntity> queryCachedInsuredByConvert(String idCardNo, String realName) {
        String key = "CACHEDINSURED:IDCARDNO:" + idCardNo;
        Object o = redisUtils.get(key);
        if (o == null) {
            InsuredEntity dto = queryInsuredByConvert(idCardNo, realName).getDto();
            if (dto == null) {
                dto = new InsuredEntity();
            }
            o = JSON.toJSONString(dto);
            redisUtils.set(key, o, 60 * 60 * 24);
        }

        return ResponseUtils.buildSuccessResponse(JSON.parseObject((String) o, InsuredEntity.class));
    }

    private String getGwybz(List<SocialSecurityEntity> dto) {
        for (SocialSecurityEntity socialSecurityEntity : dto) {
            if ("机关事业单位养老保险".equals(socialSecurityEntity.getAae140())) {
                return "是";
            }
        }
        return "否";
    }

    @Override
    public BaseResponse<List<InsuredInfoEntity>> queryInusreList(String idCardNo, String name) {
        List<InsuredInfoEntity> insuredInfoEntities = thirdPartyService.queryInusreList(idCardNo, name);
        if (CollectionUtils.isEmpty(insuredInfoEntities)) {
            return ResponseUtils.buildSuccessResponse(new ArrayList<>());
        }

        Collections.sort(insuredInfoEntities, new Comparator<InsuredInfoEntity>() {
            @Override
            public int compare(InsuredInfoEntity o1, InsuredInfoEntity o2) {
                return o2.getSjsbsj().compareTo(o1.getSjsbsj());
            }
        });


        return ResponseUtils.buildSuccessResponse(insuredInfoEntities);
    }

    private void insertSoldierEducations(List<EducationEntity> insuredInfoEntities) {
        if (CollectionUtils.isEmpty(insuredInfoEntities)) {
            return;
        }

        for (EducationEntity insuredInfoEntity : insuredInfoEntities) {
            SoldierEducationInfoBSearcher searcher = new SoldierEducationInfoBSearcher(1, 20);
            searcher.setZsbh(insuredInfoEntity.getZsbh());
            List<SoldierEducationInfoDO> list = soldierEducationInfoDao.search(searcher);
            if (!CollectionUtils.isEmpty(list)) {
                continue;
            }

            SoldierEducationInfoDO sDo = new SoldierEducationInfoDO();
            BeanUtils.copyProperties(insuredInfoEntity, sDo);

            sDo.setId(sequenceGenerator.genKey(SequenceNameConstant.SOLDIER_EDUCATION_ID));
            soldierEducationInfoDao.insert(sDo);
        }
    }

    @Override
    public BaseResponse<List<EducationEntity>> queryEducationList(String idCardNo, String name) {
        List<EducationEntity> educationEntities = new ArrayList<>();

        try {
            educationEntities = irsService.queryEducationInfo(name, idCardNo);
        } catch (Exception e) {
            educationEntities.addAll(queryEducationInDB(idCardNo));
        }

        if (CollectionUtils.isEmpty(educationEntities)) {
            educationEntities = new ArrayList<>();
            educationEntities.addAll(queryEducationInDB(idCardNo));
        }

        insertSoldierEducations(educationEntities);

        return ResponseUtils.buildSuccessResponse(educationEntities);
    }

    private List<EducationEntity> queryEducationInDB(String idCardNo) {
        List<EducationEntity> list = Lists.newArrayList();

        SoldierEducationInfoBSearcher searcher = new SoldierEducationInfoBSearcher(1, 20);
        searcher.setZjhm(idCardNo);
        List<SoldierEducationInfoDO> search = soldierEducationInfoDao.search(searcher);
        for (SoldierEducationInfoDO soldierEducationInfoDO : search) {
            EducationEntity entity = new EducationEntity();
            BeanUtils.copyProperties(soldierEducationInfoDO, entity);
            list.add(entity);
        }
        return list;
    }

    @Override
    public BaseResponse<SubsistenceEntity> querySubsistence(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        SubsistenceEntity subsistenceEntity = thirdPartyService.querySubsistence(idCardNo);
        return ResponseUtils.buildSuccessResponse(subsistenceEntity);
    }

    @Override
    public BaseResponse<List<SubsistenceAllowanceEntity>> querySubsistenceAllowance(String idCardNo) {
        SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(PrivacyEncUtils.encodeIdCardNo(idCardNo));
        if (soldierBasicInfoDO != null) {
            List<IrsSubsistenceEntity> irsSubsistenceEntities = irsService.queryDibao(idCardNo);
            if (!CollectionUtils.isEmpty(irsSubsistenceEntities)) {
                List<SubsistenceAllowanceEntity> result = new ArrayList<>();
                for (IrsSubsistenceEntity irsSubsistenceEntity : irsSubsistenceEntities) {
                    SubsistenceAllowanceEntity item = new SubsistenceAllowanceEntity();
                    item.setMhz(irsSubsistenceEntity.getBHAX0015());
                    item.setMhzsfz(irsSubsistenceEntity.getBHAX0016());
                    item.setDgx(irsSubsistenceEntity.getAHAX0017());
                    item.setDjkzk(irsSubsistenceEntity.getAHAP0022());
                    item.setMdbbz(irsSubsistenceEntity.getAHAX0036());
                    item.setMqtdbj(irsSubsistenceEntity.getBHAX0031());
                    item.setMybzje(irsSubsistenceEntity.getBHAX0030());
                    item.setMzjzje(irsSubsistenceEntity.getBHAX0032());
                    item.setMzpyy(irsSubsistenceEntity.getAHAX0004());
                    item.setMjzksrq(irsSubsistenceEntity.getBHAX0033());
                    item.convert();
                    result.add(item);
                }
                return ResponseUtils.buildSuccessResponse(result);
            }

        }

        return ResponseUtils.buildSuccessResponse(null);
    }

    @Override
    public BaseResponse<List<LowSideEntity>> queryLowSide(String idCardNo) {
        SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
        if (soldierBasicInfoDO != null) {
            List<LowSideEntity> lowSideEntities = thirdPartyService.queryLowSide(idCardNo, soldierBasicInfoDO.getRealName());
            return ResponseUtils.buildSuccessResponse(lowSideEntities);
        }

        return ResponseUtils.buildSuccessResponse(null);
    }

    @Override
    public BaseResponse<List<ExtremelyPoorEntity>> queryExtremelyPoor(String idCardNo) {
        SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
        if (soldierBasicInfoDO != null) {
            List<ExtremelyPoorEntity> extremelyPoorEntities = thirdPartyService.queryExtremelyPoor(idCardNo, soldierBasicInfoDO.getRealName());
            return ResponseUtils.buildSuccessResponse(extremelyPoorEntities);
        }

        return ResponseUtils.buildSuccessResponse(null);
    }

    @Override
    public BaseResponse<List<UnemploymentRegistrationEntity>> queryUnemploymentRegistration(String idCardNo) {
        SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
        if (soldierBasicInfoDO != null) {
            List<UnemploymentRegistrationEntity> unemploymentRegistrationEntities = thirdPartyService.queryUnemploymentRegistration(idCardNo, soldierBasicInfoDO.getRealName());
            return ResponseUtils.buildSuccessResponse(unemploymentRegistrationEntities);
        }

        return ResponseUtils.buildSuccessResponse(null);
    }

    @Override
    public BaseResponse<MedicalInsuranceConsumptionEntity> queryMedicalInsuranceConsume(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        MedicalInsuranceConsumptionEntity medicalInsuranceConsumptionEntity = thirdPartyService.queryMedicalInsuranceConsume(idCardNo, name);
        if (medicalInsuranceConsumptionEntity == null) {
            SoldierTpAllDO byIdCardNo = soldierTpAllService.getByIdCardNo(idCardNo);
            if (byIdCardNo != null && Strings.isNotBlank(byIdCardNo.getMedicalInsuranceConsumption())) {
                Object parse = JSON.parse(byIdCardNo.getMedicalInsuranceConsumption());
                if (parse != null) {
                    if (parse instanceof JSONObject) {
                        JSONObject jsonObject = (JSONObject) parse;
                        medicalInsuranceConsumptionEntity = jsonObject.toJavaObject(MedicalInsuranceConsumptionEntity.class);
                    }
                    if (parse instanceof JSONArray) {
                        JSONArray jsonArray = (JSONArray) parse;
                        List<MedicalInsuranceConsumptionEntity> medicalInsuranceConsumptionEntities = jsonArray.toJavaList(MedicalInsuranceConsumptionEntity.class);
                        medicalInsuranceConsumptionEntity = medicalInsuranceConsumptionEntities.get(0);
                    }
                }
            }
        }

        return ResponseUtils.buildSuccessResponse(medicalInsuranceConsumptionEntity);
    }

    @Override
    public BaseResponse<DisabledEntity> queryDisabledInfo(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryDisabledInfo(idCardNo));
    }

    @Override
    public BaseResponse<List<CarEntity>> queryCarList(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryCarList(idCardNo));
    }

    @Override
    public BaseResponse<List<ShareholderEntity>> queryShareholderList(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");

        List<ShareholderEntity> resultObject = irsService.queryShareholderList(idCardNo);
        if (!CollectionUtils.isEmpty(resultObject)) {
            for (ShareholderEntity shareholderEntity : resultObject) {
                List<EnterpriseInfoEntity> enterpriseInfoEntities = null;
//                if (Strings.isNotBlank(shareholderEntity.getEntname())) {
//                    enterpriseInfoEntities = thirdPartyService.queryEnterpriseListByName(shareholderEntity.getEntname());
//                } else
                if (Strings.isNotBlank(shareholderEntity.getUniscid())) {
                    enterpriseInfoEntities = irsService.queryEnterpriseList(shareholderEntity.getUniscid());
                }

                if (!CollectionUtils.isEmpty(enterpriseInfoEntities)) {
                    EnterpriseInfoEntity enterpriseInfoEntity = enterpriseInfoEntities.get(0);
                    BeanUtils.copyProperties(enterpriseInfoEntity, shareholderEntity);
                }
            }
        }

        return ResponseUtils.buildSuccessResponse(resultObject);
    }

    @Override
    public BaseResponse<List<EnterpriseInfoEntity>> queryEnterpriseList(String uniscId) {

        BizCheckUtil.checkNotNull(uniscId, "id不能为空");
        return ResponseUtils.buildSuccessResponse(irsService.queryEnterpriseList(uniscId));
    }

    @Override
    public BaseResponse<List<HouseEntity>> queryHouseList(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryHouseList(idCardNo, name));
    }

    @Override
    public BaseResponse<List<UntrustworthyEntity>> queryUntrustworthy(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        return ResponseUtils.buildSuccessResponse(irsService.queryUntrustworthy(idCardNo, name));
    }

    @Override
    public BaseResponse<List<CommunityCorrectionEntity>> queryCommunityCorrectionList(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        return ResponseUtils.buildSuccessResponse(irsService.queryCommunityCorrectionList(idCardNo));
    }

    @Override
    public BaseResponse<HouseholdRegistrationEntity> queryHouseholdRegistrationInfo(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
//        if (Strings.isNotBlank(name)) {
//            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
//            if (soldierBasicInfoDO != null) {
//                name = soldierBasicInfoDO.getRealName();
//            }
//        }

        List<SoldierNewHouseholdRegistrationInfoDO> soldierNewHouseholdRegistrationInfoDOS = thirdPartyService.queryNewHouseholdRegistrationInfo(idCardNo, name);
        HouseholdRegistrationEntity result = new HouseholdRegistrationEntity();

        if (!CollectionUtils.isEmpty(soldierNewHouseholdRegistrationInfoDOS)) {
            SoldierNewHouseholdRegistrationInfoDO newDO = soldierNewHouseholdRegistrationInfoDOS.get(0);
            BeanUtil.copyProperties(newDO, result);
            result.setIdCardNo(newDO.getId_nbr());
            result.setCsrq(newDO.getBirth_date());
            result.setHjdz(newDO.getAddr());
            result.setZxsj(newDO.getPerson_stat());
            result.setPcsmc(newDO.getIssue_mecha());
            result.setMzmc(newDO.getNational());
            result.setXbmc(newDO.getGender());
            result.setByzkmc(newDO.getMove_why());
            result.setHlxmc(newDO.getHshld());
        }

        return ResponseUtils.buildSuccessResponse(result);
    }

    @Override
    public BaseResponse<List<FloatingPopulationEntity>> queryFloatingPopulationList(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }
        return ResponseUtils.buildSuccessResponse(irsService.queryFloatingPopulationList(idCardNo, name));
    }

    @Override
    public BaseResponse<List<SocialSecurityEntity>> querySocialSecurity(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        return ResponseUtils.buildSuccessResponse(irsService.querySocialSecurity(idCardNo, name));
    }

    @Override
    public BaseResponse<InsuredEntity> querySocialSecurity2(String idCardNo, String name) {
        List<SocialSecurityEntity> dto = querySocialSecurity(idCardNo, name).getDto();
        if (!CollectionUtils.isEmpty(dto)) {
            SocialSecurityEntity socialSecurityEntity = dto.get(0);
            InsuredEntity entity = new InsuredEntity();
            entity.setXm(socialSecurityEntity.getAac003());
            entity.setSfzh(socialSecurityEntity.getAac147());
            entity.setDwmc(socialSecurityEntity.getAab004());
            entity.setYbkh(socialSecurityEntity.getAac001());
            entity.setSccbrq(socialSecurityEntity.getAae030());
            String aac031 = socialSecurityEntity.getAac031();
            if ("1".equals(aac031)) {
                entity.setYbzxbz("参保缴费");
            } else if ("2".equals(aac031)) {
                entity.setYbzxbz("暂停缴费");
            } else if ("3".equals(aac031)) {
                entity.setYbzxbz("终止缴费");
            } else {
                entity.setYbzxbz("");
            }
            entity.setGwybz(getGwybz(dto));
            entity.setLastPayTime(socialSecurityEntity.getTongTime());
            return ResponseUtils.buildSuccessResponse(entity);
        }
        return ResponseUtils.buildSuccessResponse(new InsuredEntity());
    }

    @Override
    public BaseResponse<List<EffectiveJudgmentEntity>> queryEffectiveJudgmentList(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryEffectiveJudgmentList(idCardNo, name));
    }

    @Override
    public BaseResponse<List<GovernmentPensionInsuranceEntity>> queryGovernmentPensionInsuranceList(String
                                                                                                            idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryGovernmentPensionInsuranceList(idCardNo, name));
    }

    @Override
    public BaseResponse<List<MaritalInfoEntity>> queryMaritalInfo(String idCardNo, String name, String sex) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryMaritalInfo(idCardNo, name, sex, idCardNoToBirthday(idCardNo)));
    }

    @Override
    public BaseResponse<List<ProvidentFundEntity>> queryProvidentFund(String idCardNo, String name) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");
        if (Strings.isBlank(name)) {
            SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo(idCardNo);
            if (soldierBasicInfoDO != null) {
                name = soldierBasicInfoDO.getRealName();
            }
        }

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryProvidentFund(idCardNo, name));
    }

    @Override
    public BaseResponse<List<HuKouEntity>> queryHuKouInfo(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryHuKouInfo(idCardNo));
    }

    @Override
    public BaseResponse<List<HuKouEntity>> queryHuKouBen(String idCardNo) {

        BizCheckUtil.checkNotNull(idCardNo, "身份证不能为空");

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryHuKouBen(idCardNo));
    }

    @Override
    public BaseResponse<List<EnterpriseInfoEntity>> queryEnterpriseListByName(String name) {

        return ResponseUtils.buildSuccessResponse(irsService.queryEnterpriseListByName(name));
    }

    @Override
    public BaseResponse<List<EnterpriseCreditRatingEntity>> queryEnterpriseCreditRating(String name) {

        return ResponseUtils.buildSuccessResponse(thirdPartyService.queryEnterpriseCreditRating(name));
    }

    @Override
    public BaseResponse<List<ShareholderEntity>> isMilitaryEnterprise(String uniscid) {

        SoldierTpAllDO militaryEnterprise = soldierTpAllService.isMilitaryEnterprise(uniscid);
        if (militaryEnterprise == null) {
            return ResponseUtils.buildSuccessResponse(null);
        }
        List<ShareholderEntity> resultObject = JSONArray.parseArray(militaryEnterprise.getShareholder(), ShareholderEntity.class);
        return ResponseUtils.buildSuccessResponse(resultObject);
    }

    @Override
    public BaseResponse<List<SoldierEmploymentTimeLine>> queryEmploymentLine(String idCardNo) {


        SoldierTpAllDO soldierTpAllDO = soldierTpAllService.getByIdCardNo(idCardNo);
        if (soldierTpAllDO == null) {
            soldierTpAllDO = soldierExtraInfoRefresher.refreshByIdCardNo(idCardNo);
        }
        List<SoldierEmploymentTimeLine> result = Lists.newArrayList();
        if (soldierTpAllDO.isSocialSecurityFlag()) {
            List<InsuredInfoEntity> insuredInfoEntities = ThirdPartyDealUtils.fileSocialSecurity(soldierTpAllDO.getSocialSecurity());
            if (CollectionUtils.isEmpty(insuredInfoEntities)) {
                return ResponseUtils.buildSuccessResponse(result);
            }


            insuredInfoEntities = Lists.reverse(insuredInfoEntities);
            for (InsuredInfoEntity insuredInfoEntity : insuredInfoEntities) {
                addTimeLine(result, insuredInfoEntity.getAab004(), insuredInfoEntity.getAae036());
            }

            if (soldierTpAllDO.isUnemploymentRegistrationFlag()) {
                String unemploymentRegistration = soldierTpAllDO.getUnemploymentRegistration();
                List<UnemploymentRegistrationEntity> unemploymentRegistrationEntities = JSONArray.parseArray(unemploymentRegistration, UnemploymentRegistrationEntity.class);
                for (UnemploymentRegistrationEntity unemploymentRegistrationEntity : unemploymentRegistrationEntities) {
                    addEmploymentPoint(result, unemploymentRegistrationEntity.getAae044(), "失业登记");
                }
            }
        }
        Collections.sort(result, new Comparator<SoldierEmploymentTimeLine>() {
            @Override
            public int compare(SoldierEmploymentTimeLine o1, SoldierEmploymentTimeLine o2) {
                return o2.getStartTime().compareTo(o1.getStartTime());
            }
        });

        return ResponseUtils.buildSuccessResponse(result);
    }

    private void addEmploymentPoint(List<SoldierEmploymentTimeLine> result, String date, String message) {
        for (int i = 0; i < result.size(); i++) {
            SoldierEmploymentTimeLine timeLine = result.get(i);
            String startTime = timeLine.getStartTime();
            String endTime = timeLine.getEndTime();
            if (startTime.compareTo(date) > 0 || (startTime.compareTo(date) < 0 && endTime.compareTo(date) > 0)) ;
            {
                SoldierEmploymentTimeLine line = new SoldierEmploymentTimeLine();
                line.setStartTime(date);
                line.setEndTime(date);
                line.setUnemploymentRegistrationInfo(message);
                result.add(line);
                return;
            }
        }
        SoldierEmploymentTimeLine line = new SoldierEmploymentTimeLine();
        line.setStartTime(date);
        line.setEndTime(date);
        line.setUnemploymentRegistrationInfo(message);
        result.add(line);
    }


    public static void main(String[] args) {
        String str = "[{\"aab003\":\"91330100MA2H3KLT8A\",\"aab004\":\"浙江汇思供应链管理有限公司杭州分公司\",\"aab999\":\"6647017\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202011\",\"aae011\":\"征信接口\",\"aae036\":\"2020-12-05 16:32:57.0\",\"bac601\":\"N\",\"bac603\":\"Y\",\"bad006\":\"N\",\"bad007\":\"N\",\"bad008\":\"N\",\"bad009\":\"N\",\"baz001\":\"6000007251041326\",\"baz002\":\"2000012777405559\",\"sjsbsj\":\"2020-12-20 17:26:58.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202011\",\"aae011\":\"征信接口\",\"aae036\":\"2020-12-04 14:50:18.0\",\"bac601\":\"N\",\"bac603\":\"N\",\"bad006\":\"N\",\"bad007\":\"N\",\"bad008\":\"N\",\"bad009\":\"N\",\"baz001\":\"6000007243142597\",\"baz002\":\"2000012777405559\",\"sjsbsj\":\"2020-12-06 07:38:05.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202010\",\"aae011\":\"征信接口\",\"aae036\":\"2020-11-04 06:32:23.0\",\"bac601\":\"N\",\"bac603\":\"Y\",\"bad006\":\"N\",\"bad007\":\"N\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000007129312184\",\"baz002\":\"2000012451488731\",\"sjsbsj\":\"2020-11-27 07:00:35.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202009\",\"aae011\":\"征信接口\",\"aae036\":\"2020-10-04 06:21:35.0\",\"bac601\":\"N\",\"bac603\":\"Y\",\"bad006\":\"N\",\"bad007\":\"N\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000007000556009\",\"baz002\":\"2000012117572096\",\"sjsbsj\":\"2020-10-07 04:14:27.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202008\",\"aae011\":\"征信接口\",\"aae036\":\"2020-09-04 03:11:21.0\",\"bac601\":\"N\",\"bac603\":\"Y\",\"bad006\":\"N\",\"bad007\":\"N\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000006781247874\",\"baz002\":\"2000011767916651\",\"sjsbsj\":\"2020-09-05 18:09:19.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202007\",\"aae011\":\"征信接口\",\"aae036\":\"2020-08-05 13:30:44.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000006529530263\",\"baz002\":\"2000011341929384\",\"sjsbsj\":\"2020-08-07 11:07:09.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202006\",\"aae011\":\"征信接口\",\"aae036\":\"2020-07-03 22:21:25.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005923338094\",\"baz002\":\"2000011095327793\",\"sjsbsj\":\"2020-07-06 06:40:39.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202005\",\"aae011\":\"征信接口\",\"aae036\":\"2020-06-03 03:36:35.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005741200644\",\"baz002\":\"2000010770258399\",\"sjsbsj\":\"2020-06-05 08:53:00.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202004\",\"aae011\":\"征信接口\",\"aae036\":\"2020-05-03 03:39:09.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005630150871\",\"baz002\":\"2000010455382233\",\"sjsbsj\":\"2020-05-05 06:24:25.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202003\",\"aae011\":\"征信接口\",\"aae036\":\"2020-04-03 03:31:30.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005527022760\",\"baz002\":\"2000010144694650\",\"sjsbsj\":\"2020-04-05 09:45:24.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202002\",\"aae011\":\"征信接口\",\"aae036\":\"2020-03-03 03:41:27.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005428571927\",\"baz002\":\"2000009858173942\",\"sjsbsj\":\"2020-03-04 21:50:27.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202001\",\"aae011\":\"征信接口\",\"aae036\":\"2020-02-19 12:29:54.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005356157576\",\"baz002\":\"2000009795024886\",\"sjsbsj\":\"2020-02-22 09:07:34.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201912\",\"aae011\":\"征信接口\",\"aae036\":\"2020-02-19 15:49:48.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005363941616\",\"baz002\":\"2000009795024886\",\"sjsbsj\":\"2020-02-22 09:06:27.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"202001\",\"aae011\":\"征信接口\",\"aae036\":\"2020-02-03 03:21:12.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005328707799\",\"baz002\":\"2000009736769386\",\"sjsbsj\":\"2020-02-04 01:45:26.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201912\",\"aae011\":\"征信接口\",\"aae036\":\"2020-01-03 03:34:20.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005225584698\",\"baz002\":\"2000009444339240\",\"sjsbsj\":\"2020-01-04 03:48:30.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201911\",\"aae011\":\"征信接口\",\"aae036\":\"2019-12-04 08:53:15.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000005112961188\",\"baz002\":\"2000009015628725\",\"sjsbsj\":\"2019-12-07 05:32:05.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201910\",\"aae011\":\"征信接口\",\"aae036\":\"2019-11-03 20:21:13.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000004986461562\",\"baz002\":\"2000008764471318\",\"sjsbsj\":\"2019-11-05 07:32:08.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201909\",\"aae011\":\"征信接口\",\"aae036\":\"2019-10-03 18:49:59.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000004489423706\",\"baz002\":\"2000008515138203\",\"sjsbsj\":\"2019-10-06 07:48:38.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201907\",\"aae011\":\"征信接口\",\"aae036\":\"2019-08-03 14:33:45.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000003966982852\",\"baz002\":\"2000008101577149\",\"sjsbsj\":\"2019-08-05 17:31:55.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201906\",\"aae011\":\"征信接口\",\"aae036\":\"2019-07-03 16:16:10.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000003656550666\",\"baz002\":\"2000007887816003\",\"sjsbsj\":\"2019-07-05 20:18:52.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201905\",\"aae011\":\"征信接口\",\"aae036\":\"2019-06-03 12:35:44.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000003239955120\",\"baz002\":\"2000007680319388\",\"sjsbsj\":\"2019-06-05 17:54:07.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201904\",\"aae011\":\"征信接口\",\"aae036\":\"2019-05-03 13:12:31.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000003068434117\",\"baz002\":\"2000007467700356\",\"sjsbsj\":\"2019-05-06 03:18:32.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201903\",\"aae011\":\"征信接口\",\"aae036\":\"2019-04-03 11:17:31.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000002903915898\",\"baz002\":\"2000007266370135\",\"sjsbsj\":\"2019-04-06 16:30:36.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201902\",\"aae011\":\"征信接口\",\"aae036\":\"2019-03-03 10:27:36.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000002716720741\",\"baz002\":\"2000007051485547\",\"sjsbsj\":\"2019-03-05 13:56:20.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201901\",\"aae011\":\"征信接口\",\"aae036\":\"2019-02-03 11:26:03.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000002546563426\",\"baz002\":\"2000006901900039\",\"sjsbsj\":\"2019-02-05 07:10:25.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201812\",\"aae011\":\"征信接口\",\"aae036\":\"2019-01-03 12:56:33.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000002336046265\",\"baz002\":\"2000006675107626\",\"sjsbsj\":\"2019-01-05 23:24:31.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201811\",\"aae011\":\"征信接口\",\"aae036\":\"2018-12-02 14:32:30.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000002094887766\",\"baz002\":\"2000006438127481\",\"sjsbsj\":\"2018-12-05 03:32:42.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201810\",\"aae011\":\"征信接口\",\"aae036\":\"2018-11-02 11:03:38.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000001884165916\",\"baz002\":\"2000006223963046\",\"sjsbsj\":\"2018-11-04 05:23:30.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201809\",\"aae011\":\"征信接口\",\"aae036\":\"2018-10-02 13:22:24.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000001686484084\",\"baz002\":\"2000005947201024\",\"sjsbsj\":\"2018-10-04 05:15:05.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201808\",\"aae011\":\"征信接口\",\"aae036\":\"2018-09-02 08:21:18.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000001360275094\",\"baz002\":\"2000005742033469\",\"sjsbsj\":\"2018-09-04 05:13:27.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201807\",\"aae011\":\"征信接口\",\"aae036\":\"2018-08-02 11:08:32.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000001154586598\",\"baz002\":\"2000005547795632\",\"sjsbsj\":\"2018-08-07 10:31:04.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201806\",\"aae011\":\"征信接口\",\"aae036\":\"2018-07-02 09:38:30.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000000870097529\",\"baz002\":\"2000005341310673\",\"sjsbsj\":\"2018-07-11 14:10:39.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201805\",\"aae011\":\"征信接口\",\"aae036\":\"2018-06-02 09:30:46.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000000465260504\",\"baz002\":\"2000005162851444\",\"sjsbsj\":\"2018-06-05 03:13:27.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201804\",\"aae011\":\"征信接口\",\"aae036\":\"2018-05-02 07:21:33.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000000279769870\",\"baz002\":\"2000004975495382\",\"sjsbsj\":\"2018-05-06 00:22:26.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201803\",\"aae011\":\"征信接口\",\"aae036\":\"2018-04-02 08:53:22.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000000038352093\",\"baz002\":\"2000004797173977\",\"sjsbsj\":\"2018-04-05 22:53:11.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201803\",\"aae011\":\"征信接口\",\"aae036\":\"2018-04-02 20:05:52.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"6000000043344564\",\"baz002\":\"2000004799672082\",\"sjsbsj\":\"2018-04-05 17:21:36.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201802\",\"aae011\":\"征信接口\",\"aae036\":\"2018-03-02 10:45:57.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000024190372981\",\"baz002\":\"2000004612702132\",\"sjsbsj\":\"2018-03-05 02:20:27.0\"},{\"aab003\":\"91330104574395208Q\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201801\",\"aae011\":\"征信接口\",\"aae036\":\"2018-02-02 06:39:27.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000023490782811\",\"baz002\":\"2000004467697081\",\"sjsbsj\":\"2018-02-05 07:57:51.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201712\",\"aae011\":\"征信接口\",\"aae036\":\"2018-01-03 05:57:56.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000022512672199\",\"baz002\":\"2000004262178976\",\"sjsbsj\":\"2018-01-05 11:14:38.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201711\",\"aae011\":\"征信接口\",\"aae036\":\"2017-12-02 08:10:17.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000021857010629\",\"baz002\":\"2000004122174380\",\"sjsbsj\":\"2017-12-04 06:44:11.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201710\",\"aae011\":\"征信接口\",\"aae036\":\"2017-11-02 05:25:51.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000021308323264\",\"baz002\":\"2000003998574154\",\"sjsbsj\":\"2017-11-04 04:21:12.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201709\",\"aae011\":\"征信接口\",\"aae036\":\"2017-10-02 05:55:59.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000020796302527\",\"baz002\":\"2000003885016944\",\"sjsbsj\":\"2017-10-04 07:46:21.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201708\",\"aae011\":\"征信接口\",\"aae036\":\"2017-09-02 05:41:41.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000020206076407\",\"baz002\":\"2000003765993605\",\"sjsbsj\":\"2017-09-04 06:57:45.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201707\",\"aae011\":\"征信接口\",\"aae036\":\"2017-08-02 08:03:13.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000019621500979\",\"baz002\":\"2000003644870658\",\"sjsbsj\":\"2017-08-04 05:57:08.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201706\",\"aae011\":\"征信接口\",\"aae036\":\"2017-07-02 04:34:14.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000019081725967\",\"baz002\":\"2000003538246373\",\"sjsbsj\":\"2017-07-04 06:56:31.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201705\",\"aae011\":\"征信接口\",\"aae036\":\"2017-06-02 06:20:39.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000018460456572\",\"baz002\":\"2000003436307535\",\"sjsbsj\":\"2017-06-04 06:03:44.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201704\",\"aae011\":\"征信接口\",\"aae036\":\"2017-05-02 02:30:12.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000017966699618\",\"baz002\":\"2000003335319282\",\"sjsbsj\":\"2017-05-03 04:21:02.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201703\",\"aae011\":\"征信接口\",\"aae036\":\"2017-04-02 02:20:13.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000017513450720\",\"baz002\":\"2000003241150156\",\"sjsbsj\":\"2017-04-13 02:41:14.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201702\",\"aae011\":\"征信接口\",\"aae036\":\"2017-03-02 06:16:21.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000017036742980\",\"baz002\":\"2000003139713009\",\"sjsbsj\":\"2017-03-03 08:01:09.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201701\",\"aae011\":\"征信接口\",\"aae036\":\"2017-02-02 01:55:34.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000016632117748\",\"baz002\":\"2000003054791973\",\"sjsbsj\":\"2017-02-03 03:06:49.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201612\",\"aae011\":\"征信接口\",\"aae036\":\"2017-01-02 02:54:55.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000016231147379\",\"baz002\":\"2000002964995787\",\"sjsbsj\":\"2017-01-03 10:59:02.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201611\",\"aae011\":\"征信接口\",\"aae036\":\"2016-12-02 01:07:49.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000015694021624\",\"baz002\":\"2000002858346701\",\"sjsbsj\":\"2016-12-03 03:33:14.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201610\",\"aae011\":\"征信接口\",\"aae036\":\"2016-11-02 01:17:30.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000015229471167\",\"baz002\":\"2000002760679051\",\"sjsbsj\":\"2016-11-03 02:46:17.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201609\",\"aae011\":\"征信接口\",\"aae036\":\"2016-10-02 01:12:26.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000014697164325\",\"baz002\":\"2000002660060531\",\"sjsbsj\":\"2016-10-03 02:35:19.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201608\",\"aae011\":\"征信接口\",\"aae036\":\"2016-09-02 01:41:41.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000014205605723\",\"baz002\":\"2000002566127894\",\"sjsbsj\":\"2016-09-07 02:03:55.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201607\",\"aae011\":\"征信接口\",\"aae036\":\"2016-08-02 01:19:23.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000013772184255\",\"baz002\":\"2000002473116755\",\"sjsbsj\":\"2016-08-03 02:40:12.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201606\",\"aae011\":\"征信接口\",\"aae036\":\"2016-07-02 01:08:19.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000013249121360\",\"baz002\":\"2000002376127728\",\"sjsbsj\":\"2016-07-03 02:16:42.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201605\",\"aae011\":\"征信接口\",\"aae036\":\"2016-06-02 00:48:20.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000012704003908\",\"baz002\":\"2000002289129297\",\"sjsbsj\":\"2016-06-03 02:34:54.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201604\",\"aae011\":\"征信接口\",\"aae036\":\"2016-05-02 00:57:57.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000012254713124\",\"baz002\":\"2000002201442831\",\"sjsbsj\":\"2016-05-06 18:20:46.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201603\",\"aae011\":\"征信接口\",\"aae036\":\"2016-04-02 00:46:10.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000011869154632\",\"baz002\":\"2000002120346687\",\"sjsbsj\":\"2016-04-19 16:35:19.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201602\",\"aae011\":\"征信接口\",\"aae036\":\"2016-03-02 00:43:53.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000011449952706\",\"baz002\":\"2000002029439053\",\"sjsbsj\":\"2016-03-03 01:21:52.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201601\",\"aae011\":\"征信接口\",\"aae036\":\"2016-02-02 00:28:37.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000011139337243\",\"baz002\":\"2000001963257545\",\"sjsbsj\":\"2016-02-02 11:54:41.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201512\",\"aae011\":\"征信接口\",\"aae036\":\"2016-01-02 00:28:42.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000010693331244\",\"baz002\":\"2000001821545986\",\"sjsbsj\":\"2016-01-03 00:00:23.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201511\",\"aae011\":\"征信接口\",\"aae036\":\"2015-12-02 00:23:40.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000010208907649\",\"baz002\":\"2000001725301076\",\"sjsbsj\":\"2015-12-02 23:28:02.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201510\",\"aae011\":\"征信接口\",\"aae036\":\"2015-11-02 00:36:21.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000009802389236\",\"baz002\":\"2000001643456249\",\"sjsbsj\":\"2015-11-02 23:32:20.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201509\",\"aae011\":\"征信接口\",\"aae036\":\"2015-10-02 00:32:54.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000009427856923\",\"baz002\":\"2000001569592646\",\"sjsbsj\":\"2015-10-02 23:05:41.0\"},{\"aab003\":\"57439520-8\",\"aab004\":\"杭州中坤电器有限公司\",\"aab999\":\"0072312\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aac004\":\"1\",\"aac999\":\"11559731\",\"aae002\":\"201508\",\"aae011\":\"征信接口\",\"aae036\":\"2015-09-02 00:32:53.0\",\"bac601\":\"Y\",\"bac603\":\"Y\",\"bad006\":\"Y\",\"bad007\":\"Y\",\"bad008\":\"Y\",\"bad009\":\"N\",\"baz001\":\"2000008937994925\",\"baz002\":\"2000001483180717\",\"sjsbsj\":\"2015-09-18 15:54:25.0\"}]";

        List<InsuredInfoEntity> insuredInfoEntities = JSONArray.parseArray(str, InsuredInfoEntity.class);
        Collections.sort(insuredInfoEntities, new Comparator<InsuredInfoEntity>() {
            @Override
            public int compare(InsuredInfoEntity o1, InsuredInfoEntity o2) {
                return o1.getAae036().compareTo(o2.getAae036());
            }
        });

        List<SoldierEmploymentTimeLine> result = Lists.newArrayList();
        for (InsuredInfoEntity insuredInfoEntity : insuredInfoEntities) {
            new SoldierBasicInfoProviderImpl().addTimeLine(result, insuredInfoEntity.getAab004(), insuredInfoEntity.getAae036());
        }

        String unemploymentRegistration = "[{\"aaa020\":\"星都\",\"aac001\":\"330110015165661\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aae044\":\"2020-12-30 00:00:00.0\",\"aae100\":\"有效\",\"ajc00a\":\"\",\"ajc090\":\"2020-12-01 00:00:00.0\",\"ajc093\":\"01\",\"bae037\":\"\",\"bae043\":\"\",\"baf003\":\"余杭区\",\"baf004\":\"星桥街道\",\"baf005\":\"3301101611\",\"bdc040\":\"0232edf984514dd0\",\"bdc049\":\"330110201230013428\",\"bod041\":\"\"},{\"aaa020\":\"星都\",\"aac001\":\"330110015165661\",\"aac002\":\"230523198211084058\",\"aac003\":\"陈曦\",\"aae044\":\"2020-12-29 00:00:00.0\",\"aae100\":\"有效\",\"ajc00a\":\"\",\"ajc090\":\"2020-12-01 00:00:00.0\",\"ajc093\":\"01\",\"bae037\":\"\",\"bae043\":\"\",\"baf003\":\"余杭区\",\"baf004\":\"星桥街道\",\"baf005\":\"3301101611\",\"bdc040\":\"1b4a53e5f4927880\",\"bdc049\":\"330110201229013291\",\"bod041\":\"2020-12-29 16:09:27.0\"}]";
        List<UnemploymentRegistrationEntity> unemploymentRegistrationEntities = JSONArray.parseArray(unemploymentRegistration, UnemploymentRegistrationEntity.class);
        for (UnemploymentRegistrationEntity unemploymentRegistrationEntity : unemploymentRegistrationEntities) {
            new SoldierBasicInfoProviderImpl().addEmploymentPoint(result, unemploymentRegistrationEntity.getAae044(), "失业登记");
        }
        return;
    }

    private void addTimeLine(List<SoldierEmploymentTimeLine> list, String companyName, String date) {
        if (list.size() == 0) {
            SoldierEmploymentTimeLine timeLine = new SoldierEmploymentTimeLine();
            timeLine.setCompanyName(companyName);
            timeLine.setStartTime(date);
            list.add(timeLine);
        }

        SoldierEmploymentTimeLine timeLine = list.get(list.size() - 1);
        if (timeLine.getCompanyName().equals(companyName)) {
            timeLine.setEndTime(date);
        } else {
            SoldierEmploymentTimeLine newLine = new SoldierEmploymentTimeLine();
            newLine.setCompanyName(companyName);
            newLine.setStartTime(date);
            list.add(newLine);
        }
    }

    private String idCardNoToBirthday(String idCardNo) {
        String y = idCardNo.substring(6, 10);
        String m = idCardNo.substring(10, 12);
        String d = idCardNo.substring(12, 14);
        return y + "-" + m + "-" + d;
    }


    @Override
    public BaseResponse<String> testRefreshBaicInfoToDB() {
        stableThirdPartyRefresher.refresh();
        return ResponseUtils.buildSuccessResponse("");


    }

    @Transactional
    @Override
    public BaseResponse<String> importNewSoldierInfo() {

        boolean importNewSoldierInfo = redisLock.tryLock("importNewSoldierInfo", 100000);
        if (!importNewSoldierInfo) {
            return ResponseUtils.buildSuccessResponse("");
        }
        List<SoldierBasicImportDO> soldierBasicImportDOS = soldierBasicImportService.listAllSoldierNotInBasic();
        List<SoldierBasicImportDO> uniSoldiers = getUniSoldiers(soldierBasicImportDOS);
        for (SoldierBasicImportDO uniSoldier : uniSoldiers) {

            SoldierBasicInfoDO info = new SoldierBasicInfoDO();
            info.setIdCardNo(uniSoldier.getIdCardNo());
            info.setRealName(uniSoldier.getRealName());
            info.setNation(uniSoldier.getNation());
            info.setGender(uniSoldier.getGender().equals("男性") ? "MALE" : "FEMALE");
            info.setBirthday(stringToDate(uniSoldier.getBirthdayStr()));
            info.setRootAdminAreaValue(uniSoldier.getRootAdminAreaValue());
            info.setResidentAddress(uniSoldier.getResidentAddress());
            info.setSoldierType(optSoldierType(uniSoldier.getSoldierType()));
            info.setSoldierTypeDictCode(getSoldierTypeCodes(uniSoldier.getSoldierType()));
            info.setHouseholdRegisterType(uniSoldier.getHouseholdRegisterType());
            info.setEducationLevel(uniSoldier.getEducationLevel());
            info.setPoliticalOutlook(uniSoldier.getPoliticalOutlook());
            info.setNowWorkUnit(uniSoldier.getNowWorkUnit());
            info.setMaritalStatus(uniSoldier.getMaritalStatus());
            info.setCollector(uniSoldier.getCollector());
            info.setCollectionUnit(uniSoldier.getCollectionUnit());
            info.setDeleted(false);
            info.setCreatorId("admin");
            SoldierBasicInfoDTO dto = new SoldierBasicInfoDTO();
            BeanUtils.copyProperties(info, dto);
            info.setResidentAdminAreaCode(commonAdminAreaProvider.analyseAreaCodeByBasicInfo(dto).getDto());
            soldierBasicInfoService.insert(info);

            for (String soldierType : info.getSoldierType().split(",")) {
                SoldierTypeDO typeDO = new SoldierTypeDO();
                typeDO.setSoldierId(info.getId());
                typeDO.setSoldierType(soldierType);
                typeDO.setAdminAreaCode(info.getResidentAdminAreaCode());
                soldierTypeService.insert(typeDO);
            }


            SoldierApplyInfoDO applyInfoDO = soldierApplyInfoService.getByIdCardNo(info.getIdCardNo());
            if (applyInfoDO != null && !applyInfoDO.getStatus().equals("SUCCESS")) {
                if (applyInfoDO.getStatus().equals("REJECT")) {
                    applyInfoDO.setStatus("DEALING");
                    soldierApplyInfoService.update(applyInfoDO);
                }
                SoldierApplyInfoInsertRequest request = new SoldierApplyInfoInsertRequest();
                request.setId(applyInfoDO.getId());
                request.setCondition("0");
                request.setComment("<系统自动通过，已经采集入库>" + applyInfoDO.getComment());
                soldierApplyInfoProvider.completeTask(request);
            }
        }

        return ResponseUtils.buildSuccessResponse("success");
    }

    @Override
    public BaseResponse<String> setSoldierDead(SimpleApiRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotNull(request.getAdminAreaCode(), "行政区划不能为空");
        String idCardNo = request.getIdCardNo();
        if (idCardNo != null) {
            SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByIdCardNo(idCardNo);
            BizCheckUtil.checkNotNull(byIdCardNo, "该人不存在");
            Integer integer = soldierBasicInfoService.setSoldierDead(idCardNo, request.getInfo());
            return ResponseUtils.buildSuccessResponse(String.valueOf(integer));
        } else {
            String name = request.getName();

            List<SoldierBasicInfoDO> list = soldierBasicInfoService.listByNameAndAdminAreaCode(name, request.getAdminAreaCode());
            BizCheckUtil.checkIsTrue(!CollectionUtils.isEmpty(list), "该人不存在");
            BizCheckUtil.checkIsTrue(list.size() == 1, "存在多人");

            SoldierBasicInfoDO basicInfoDO = list.get(0);
            Integer integer = soldierBasicInfoService.setSoldierDead(basicInfoDO.getIdCardNo(), request.getInfo());
            return ResponseUtils.buildSuccessResponse(String.valueOf(integer));
        }
    }

    @Override
    public BaseResponse<Integer> addLabels(SoldierBasicInfoUpdateRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotNull(request.getLabels(), "标签不能为空");
        BizCheckUtil.checkNotNull(request.getIdCardNo(), "身份证不能为空");

        SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByIdCardNo(request.getIdCardNo());
        BizCheckUtil.checkNotNull(byIdCardNo, "不存在");

        String labels = byIdCardNo.getLabels();
        if (Strings.isNotBlank(labels)) {
            byIdCardNo.setLabels(labels + "," + request.getLabels().trim());
        } else {
            byIdCardNo.setLabels(request.getLabels());
        }
        Integer update = soldierBasicInfoService.update(byIdCardNo);
        return ResponseUtils.buildSuccessResponse(update);
    }

    @Override
    public BaseResponse<Integer> fixBirthday(SoldierBasicInfoUpdateRequest request) {

        List<SoldierBasicInfoDO> soldierBasicInfoDOS = soldierBasicInfoService.listProblemBirthday();
        for (SoldierBasicInfoDO soldierBasicInfoDO : soldierBasicInfoDOS) {

            String s = idCardNoToBirthday(soldierBasicInfoDO.getIdCardNo());
            DateTime parse = DateUtil.parse(s, "yyyy-MM-dd");
            Timestamp t = new Timestamp(parse.getTime());
            soldierBasicInfoDO.setBirthday(t);
            log.info("{},{}", soldierBasicInfoDO.getIdCardNo(), soldierBasicInfoDO.getBirthday());
            soldierBasicInfoService.update(soldierBasicInfoDO);

        }
        return ResponseUtils.buildSuccessPagingResponse(0);
    }

    @Override
    public BaseResponse<Integer> fixResidentAdminAreaCode(SoldierBasicInfoUpdateRequest request) {

        ThreadPoolManager.getInstance().submit(new Runnable() {
            @Override
            public void run() {
                List<SoldierBasicInfoDO> soldierBasicInfoDOS = soldierBasicInfoService.listTestIdTable(request.getResidentAddress());
                int count = 1;
                for (SoldierBasicInfoDO test : soldierBasicInfoDOS) {
                    try {
                        log.info("loop：{}，{}", count++, soldierBasicInfoDOS.size());
                        String code = commonAdminAreaProvider.analyseAreaCodeByBasicInfo(test.getRemark());
                        SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByIdCardNo(test.getIdCardNo());
                        if (byIdCardNo != null) {
                            byIdCardNo.setResidentAdminAreaCode(code);
                            soldierBasicInfoService.update(byIdCardNo);
                        }
                    } catch (Exception e) {
                        log.error("{}", e);
                    }
                }
            }
        });

        return ResponseUtils.buildSuccessResponse(0);
    }


    private String convertJdlkSoldierTypeToMy(String soldierTypeDetail) {
        if (Strings.isBlank(soldierTypeDetail)) {
            return null;
        }
        if (soldierTypeDetail.contains("复员军人")) {
            return "复员军人";
        }
        if (soldierTypeDetail.contains("退休士官")) {
            return "退休士官";
        }
        if (soldierTypeDetail.contains("军队离退休干部")) {
            return "军队离退休干部";
        }
        if (soldierTypeDetail.contains("企业军转干部") || soldierTypeDetail.contains("复员军官") || soldierTypeDetail.contains("军转干部") || soldierTypeDetail.contains("转制人员 — 转制干部")) {
            return "军队转业干部";
        }

        return "退役士兵";
    }

    @Override
    public BaseResponse<Integer> importSyfInfoToBasicDb(SimpleApiRequest request) {

        BizCheckUtil.checkNotBlank(request.getCode(), "cookie不能为空");

        String adminAreaCode = request.getAdminAreaCode();
        BizCheckUtil.checkNotNull(adminAreaCode);
        CommonAdminAreaDO commonAdminAreaDO = commonAdminAreaService.get(adminAreaCode);
        BizCheckUtil.checkNotNull(commonAdminAreaDO);

        ThreadPoolManager.getInstance().submit(new Runnable() {
            @Override
            public void run() {
                List<SyfSoldierInfo> syfSoldierInfos = Lists.newArrayList();
                int pageNo = 1;
                String cookie = request.getCode();
                do {
                    List<SyfSoldierInfo> thisTurn = syfxtService.querySoldierList(pageNo++, 100, cookie);
                    if (!CollectionUtils.isEmpty(thisTurn)) {
                        syfSoldierInfos.addAll(thisTurn);
                    } else {
                        break;
                    }
                } while (true);

                for (SyfSoldierInfo syfSoldierInfo : syfSoldierInfos) {
                    String cardId = syfSoldierInfo.getCardId();
                    SoldierBasicInfoDO byIdCardNo = soldierBasicInfoService.getByIdCardNo(cardId);
                    if (byIdCardNo != null) {
                        byIdCardNo.setPretreatmentType(syfSoldierInfo.getApptypeTitle());
                        soldierBasicInfoService.update(byIdCardNo);
                    }
                }

            }
        });

        return ResponseUtils.buildSuccessResponse(0);
    }

    @Override
    public BaseResponse<Integer> encAllTable(SimpleApiRequest request) {
        privacyEncComponent.encAllTable();
        return ResponseUtils.buildSuccessResponse(0);
    }

    private Date strToDate(String str) {
        if (Strings.isBlank(str)) {
            return null;
        }
        try {
            DateTime parse = DateUtil.parse(str, "yyyy-MM-dd");
            return parse.toJdkDate();
        } catch (Exception e) {
            log.error("{}", e);
        }
        return null;
    }


    @Override
    public BaseResponse<ExcelResultBO> queryAreaQrDetailExcel(SimpleApiRequest request) {

        BizCheckUtil.checkNotBlank(request.getAdminAreaCode(), "地区不能为空");


        List<Map<String, String>> list = soldierBasicInfoService.queryAreaQrDetail(request.getAdminAreaCode());
        List<String> headers = Lists.newArrayList("地区（部分数据由于采集信息不准确，只能将部分人员划分到区县街道）", "姓名", "是否领取老兵码");
        List<List<String>> data = Lists.newArrayList();

        for (Map<String, String> map : list) {
            data.add(Lists.newArrayList(map.get("地区"), map.get("姓名"), map.get("是否领取老兵码")));
        }

        return ResponseUtils.buildSuccessResponse(new ExcelResultBO("查询老兵码领取情况", headers, data));
    }


    @Override
    public BasePagingResponse<List<SoldierBasicInfoDTO>> superSearchSoldierBasicInfo(SoldierBasicInfoSearchRequest
                                                                                             searchRequest) {
        return null;
    }

    @Override
    public BaseResponse<String> superExportSoldierBasicInfo(SoldierBasicInfoSearchRequest searchRequest) {


        CommonTmpInfoDO infoDO = new CommonTmpInfoDO();
        infoDO.setTitle("一人一档导出");
        commonTmpInfoService.insert(infoDO);


        ThreadPoolManager.getInstance().submit(new Runnable() {
            @Override
            public void run() {
                try {
                    searchRequest.setPageNo(1);
                    searchRequest.setPageSize(Integer.MAX_VALUE);
                    List<SoldierBasicInfoDTO> basicInfoDTOS = searchSoldierBasicInfo(searchRequest).getDto();
                    List<String> headers = Lists.newArrayList("姓名", "身份证", "性别", "民族", "户口类型", "政治面貌", "退役军人类型", "荣誉", "困难类型", "居住地", "手机号"
                            , "社保缴纳", "学历信息", "医保信息", "公安户籍", "婚姻情况", "流动人口", "法人信息", "房产信息", "车辆信息", "失信信息", "矫正信息");
                    headers = FieldFilterUtils.filterHeader(headers, searchRequest.getFields());

                    Map<String, List<String>> idCardItemMap = Maps.newHashMap();
                    List<List<String>> data = Lists.newArrayList();
                    if (!CollectionUtils.isEmpty(basicInfoDTOS)) {
                        for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {


                            List<String> item = Lists.newArrayList();
                            idCardItemMap.put(basicInfoDTO.getIdCardNo(), item);

                            if (headers.contains("姓名")) {
                                item.add(basicInfoDTO.getRealName());
                            }
                            if (headers.contains("身份证")) {
                                item.add(basicInfoDTO.getIdCardNo());
                            }
                            if (headers.contains("性别")) {
                                item.add(GenderEnum.getByEnumName(basicInfoDTO.getGender()).getDesc());
                            }
                            if (headers.contains("民族")) {
                                item.add(basicInfoDTO.getNation());
                            }
                            if (headers.contains("户口类型")) {
                                item.add(basicInfoDTO.getHouseholdRegisterType());
                            }
                            if (headers.contains("政治面貌")) {
                                item.add(basicInfoDTO.getPoliticalOutlook());
                            }
                            if (headers.contains("退役军人类型")) {
                                item.add(basicInfoDTO.getSoldierType());
                            }
                            if (headers.contains("荣誉")) {
                                item.add(basicInfoDTO.getLabels());
                            }
                            if (headers.contains("困难类型")) {
                                item.add(basicInfoDTO.getDifficultyType());
                            }
                            if (headers.contains("居住地")) {
                                item.add(basicInfoDTO.getResidentAddress());
                            }
                            if (headers.contains("手机号")) {
                                item.add(basicInfoDTO.getMobile());
                            }
                            data.add(item);
                        }

                        SoldierBasicInfoBSearcher searcher = convertSearcher(searchRequest);
                        if (headers.contains("社保缴纳")) {
                            searcher.setColumn("is_social_security_flag,social_security,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isSocialSecurityFlag()) {
                                    List<InsuredInfoEntity> insuredInfoEntities = ThirdPartyDealUtils.fileSocialSecurity(soldierTpAllDO.getSocialSecurity());
                                    if (CollectionUtils.isEmpty(insuredInfoEntities)) {
                                        list.add("");
                                    } else {
                                        InsuredInfoEntity lastOne = insuredInfoEntities.get(0);
                                        list.add(lastOne.shortInfo());
                                    }
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("学历信息")) {
                            searcher.setColumn("is_education_flag,education,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isEducationFlag()) {
                                    List<EducationEntity> entityList = JSONArray.parseArray(soldierTpAllDO.getEducation(), EducationEntity.class);
                                    EducationEntity educationEntity = entityList.get(entityList.size() - 1);
                                    list.add(educationEntity.shortInfo());
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("医保信息")) {
                            searcher.setColumn("is_medical_insurance_consumption_flag,medical_insurance_consumption,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);
                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());

                                if (soldierTpAllDO != null && soldierTpAllDO.isMedicalInsuranceConsumptionFlag()) {
                                    Object parse = JSON.parse(soldierTpAllDO.getMedicalInsuranceConsumption());
                                    if (parse instanceof JSONObject) {
                                        JSONObject jsonObject = (JSONObject) parse;
                                        MedicalInsuranceConsumptionEntity medicalInsuranceConsumptionEntity = jsonObject.toJavaObject(MedicalInsuranceConsumptionEntity.class);
                                        list.add(medicalInsuranceConsumptionEntity.shortInfo());
                                    } else if (parse instanceof JSONArray) {
                                        JSONArray arr = (JSONArray) parse;
                                        List<MedicalInsuranceConsumptionEntity> medicalInsuranceConsumptionEntities = arr.toJavaList(MedicalInsuranceConsumptionEntity.class);
                                        MedicalInsuranceConsumptionEntity medicalInsuranceConsumptionEntity = medicalInsuranceConsumptionEntities.get(0);
                                        list.add(medicalInsuranceConsumptionEntity.shortInfo());
                                    } else {
                                        list.add("");
                                    }
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("公安户籍")) {
                            searcher.setColumn("is_household_registration_flag,household_registration,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);
                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isHouseholdRegistrationFlag()) {
                                    SoldierHouseholdRegistrationInfoDO registrationInfoDO = JSON.parseObject(soldierTpAllDO.getHouseholdRegistration(), SoldierHouseholdRegistrationInfoDO.class);
                                    list.add(registrationInfoDO.shortInfo());
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("婚姻情况")) {
                            searcher.setColumn("is_marital_flag,marital,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isMaritalFlag()) {
                                    List<MaritalInfoEntity> entityList = JSONArray.parseArray(soldierTpAllDO.getMarital(), MaritalInfoEntity.class);
                                    MaritalInfoEntity maritalInfoEntity = entityList.get(0);
                                    list.add(maritalInfoEntity.shortInfo());
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("流动人口")) {
                            searcher.setColumn("is_floating_population_flag,floating_population,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isFloatingPopulationFlag()) {
                                    List<FloatingPopulationEntity> entityList = JSONArray.parseArray(soldierTpAllDO.getFloatingPopulation(), FloatingPopulationEntity.class);
                                    FloatingPopulationEntity floatingPopulationEntity = entityList.get(0);
                                    list.add(floatingPopulationEntity.shortInfo());
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("法人信息")) {
                            searcher.setColumn("is_shareholder_flag,shareholder,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isShareholderFlag()) {
                                    List<ShareholderEntity> shareholderEntities = JSONArray.parseArray(soldierTpAllDO.getShareholder(), ShareholderEntity.class);
                                    ShareholderEntity shareholderEntity = shareholderEntities.get(0);
                                    list.add(shareholderEntity.shortInfo());
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("房产信息")) {
                            searcher.setColumn("is_house_flag,house,id_card_no");
                            searcher.setColumns(Lists.newArrayList("is_house_flag", "house"));
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isHouseFlag()) {
                                    List<HouseEntity> shareholderEntities = JSONArray.parseArray(soldierTpAllDO.getHouse(), HouseEntity.class);
                                    List<String> collect = shareholderEntities.stream().map(s -> s.shortInfo()).collect(Collectors.toList());
                                    list.add(String.join("|", collect));
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("车辆信息")) {
                            searcher.setColumn("is_car_flag,car,id_card_no");
                            searcher.setColumns(Lists.newArrayList("is_car_flag", "car"));
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isCarFlag()) {
                                    List<CarEntity> entityList = JSONArray.parseArray(soldierTpAllDO.getCar(), CarEntity.class);
                                    List<String> collect = entityList.stream().map(s -> s.shortInfo()).collect(Collectors.toList());
                                    list.add(String.join("|", collect));
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("失信信息")) {
                            searcher.setColumn("is_untrustworthy_flag,untrustworthy,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isUntrustworthyFlag()) {
                                    List<UntrustworthyEntity> entityList = JSONArray.parseArray(soldierTpAllDO.getUntrustworthy(), UntrustworthyEntity.class);
                                    List<String> collect = entityList.stream().map(s -> s.shortInfo()).collect(Collectors.toList());
                                    list.add(String.join("|", collect));
                                } else {
                                    list.add("");
                                }
                            }
                        }
                        if (headers.contains("矫正信息")) {
                            searcher.setColumn("is_community_correction_flag,community_correction,id_card_no");
                            List<SoldierTpAllDO> soldierTpAllDOS = soldierTpAllService.searchItem(searcher);
                            Map<String, SoldierTpAllDO> soldierMap = toTpAllMap(soldierTpAllDOS);

                            for (SoldierBasicInfoDTO basicInfoDTO : basicInfoDTOS) {
                                SoldierTpAllDO soldierTpAllDO = soldierMap.get(basicInfoDTO.getIdCardNo());
                                List<String> list = idCardItemMap.get(basicInfoDTO.getIdCardNo());
                                if (soldierTpAllDO != null && soldierTpAllDO.isCommunityCorrectionFlag()) {
                                    List<CommunityCorrectionEntity> entityList = JSONArray.parseArray(soldierTpAllDO.getCommunityCorrection(), CommunityCorrectionEntity.class);
                                    List<String> collect = entityList.stream().map(s -> s.shortInfo()).collect(Collectors.toList());
                                    list.add(String.join("|", collect));
                                } else {
                                    list.add("");
                                }
                            }
                        }

                    }
                    ExcelResultBO excelResultBO = new ExcelResultBO("一人一档", headers, data);

                    infoDO.setContent(JSON.toJSONString(excelResultBO));
                    infoDO.setUsed(false);
                    commonTmpInfoService.update(infoDO);
                } catch (Exception e) {
                    log.error("{}", e);
                }
            }
        });

        return ResponseUtils.buildSuccessResponse(infoDO.getId());
    }

    private Map<String, SoldierTpAllDO> toTpAllMap(List<SoldierTpAllDO> soldierTpAllDOS) {
        Map<String, SoldierTpAllDO> soldierMap = Maps.newHashMap();
        for (SoldierTpAllDO soldierTpAllDO : soldierTpAllDOS) {
            soldierMap.put(soldierTpAllDO.getIdCardNo(), soldierTpAllDO);
        }
        return soldierMap;
    }

    @Override
    public BaseResponse<ExcelResultBO> queryExportInfo(CommonTmpInfoSearchRequest searchRequest) {

        BizCheckUtil.checkNotNull(searchRequest, "请求不能为空");
        BizCheckUtil.checkNotNull(searchRequest.getDownloadId(), "downloadId不能为空");

        CommonTmpInfoDO commonTmpInfoDO = commonTmpInfoService.get(searchRequest.getDownloadId());
        if (commonTmpInfoDO == null) {
            return ResponseUtils.buildSuccessResponse(null);
        }
        if (Boolean.FALSE.equals(commonTmpInfoDO.getUsed())) {
            ExcelResultBO resultObject = JSON.parseObject(commonTmpInfoDO.getContent(), ExcelResultBO.class);

            commonTmpInfoService.realDel(commonTmpInfoDO.getId());
            return ResponseUtils.buildSuccessResponse(resultObject);
        }
        return ResponseUtils.buildSuccessResponse(null);
    }

    @Transactional
    @Override
    public BaseResponse<SoldierTokenDTO> obtainJxAuth(SoldierTokenRequest request) {

        BizCheckUtil.checkNotBlank(request.getSoldierId(), "soldierId不能为空");

        if (Strings.isBlank(request.getJxToken())) {

            SoldierBasicInfoDO bySoldierId = soldierBasicInfoService.getBySoldierId(request.getSoldierId());
            if (bySoldierId != null) {
                Map<String, String> requestParamMap = new HashMap<>();
                requestParamMap.put("idCardNo", bySoldierId.getIdCardNo());
                String sign = SecurityUtil.signRequest(requestParamMap, "jxadmin12qwaszx");
                requestParamMap.put("sign", sign);
                String s = OkHttp3Util.sendByPostJson(jxBaseUrl + "/account/login-h5", JSON.toJSONString(requestParamMap));
                SoldierTokenDTO soldierTokenDTO = JSONObject.parseObject(s, SoldierTokenDTO.class);
                return ResponseUtils.buildSuccessResponse(soldierTokenDTO);
            }
        } else {

            SoldierBasicInfoDO bySoldierId = soldierBasicInfoService.getBySoldierId(request.getSoldierId());
            if (bySoldierId == null) {

                Map<String, String> header = Maps.newHashMap();
                header.put("Authorization", request.getJxToken());
                String s = OkHttp3Util.sendByPostJson(jxBaseUrl + "/account/my-info", "{}", header);
                SoldierTokenDTO soldierTokenDTO = JSONObject.parseObject(s, SoldierTokenDTO.class);
                JSONObject data = soldierTokenDTO.getData();
                if (data == null) {
                    return ResponseUtils.buildSuccessResponse(new SoldierTokenDTO(1));
                }
                String idCard = data.getString("idCard");
                String userName = data.getString("userName");
                String phone = data.getString("phone");

                SoldierApplyInfoDO byIdCardNo = soldierApplyInfoService.getByIdCardNo(idCard);
                if (byIdCardNo == null) {
                    SoldierApplyInfoDO soldierApplyInfoDO = new SoldierApplyInfoDO();
                    soldierApplyInfoDO.setIdCardNo(idCard);
                    soldierApplyInfoDO.setRealName(userName);
                    soldierApplyInfoDO.setMobile(phone);
                    soldierApplyInfoDO.setSoldierId(request.getSoldierId());
                    soldierApplyInfoDO.setSoldierType("军队离退休干部");
                    soldierApplyInfoDO.setManualCheck(true);
                    soldierApplyInfoDO.setResidentAdminAreaCode("330100000000");
                    soldierApplyInfoDO.setStatus(ProcessStatusEnum.SUCCESS.name());
                    soldierApplyInfoDO.setCount(1);
                    soldierApplyInfoService.insert(soldierApplyInfoDO);
                    soldierApplyInfoService.afterSoldierApplySucc(soldierApplyInfoDO.getId());
                } else {
                    soldierApplyInfoService.afterSoldierApplySucc(byIdCardNo.getId());
                }

                return ResponseUtils.buildSuccessResponse(soldierTokenDTO);
            }
        }

        return ResponseUtils.buildSuccessResponse(new SoldierTokenDTO(1));
    }

    @Override
    public BaseResponse<List<String>> listAllIdCardNo() {
        return ResponseUtils.buildSuccessResponse(soldierBasicInfoService.listAllIdCardNo());
    }

    @Override
    public BaseResponse<String> checkStudent() {

        ThreadPoolManager.getInstance().submit(new Runnable() {
            @Override
            public void run() {
                IScrollGet<SoldierBasicInfoDO> scrollGetTask = new IScrollGet<SoldierBasicInfoDO>() {
                    SoldierBasicInfoBSearcher bSearcher = new SoldierBasicInfoBSearcher(1, 100);

                    @Override
                    public List<SoldierBasicInfoDO> scrollGetFunc(Integer pageNo) {
                        bSearcher.setPageNo(pageNo);
                        bSearcher.setIdCardAge(35);
                        List<SoldierBasicInfoDO> search = soldierBasicInfoService.search(bSearcher);
                        return search;
                    }
                };

                Iterator<SoldierBasicInfoDO> dataIterator = scrollGetTask.getDataIterator();

                int count = 0;
                Map<String, Integer> resultMap = Maps.newHashMap();
                while (dataIterator.hasNext()) {
                    SoldierBasicInfoDO next = dataIterator.next();
                    try {
                        Boolean student = thirdPartyService.isStudent(next.getIdCardNo());
                        if (Boolean.TRUE.equals(student)) {
                            count++;
                            log.info("找到一个学生：{}， {}", next.getRealName(), next.getIdCardNo());
                            if (next.getRetireDatetime() != null) {
                                String year = DateUtil.format(next.getRetireDatetime(), "yyyy");
                                Integer integer = resultMap.get(year);
                                if (integer == null) {
                                    resultMap.put(year, 1);
                                } else {
                                    resultMap.put(year, integer + 1);
                                }
                            } else {
                                log.info("找到一个学生：没有退役时间{}， {}", next.getRealName(), next.getIdCardNo());
                            }
                        }
                    } catch (DocumentException e) {
                        e.printStackTrace();
                    }
                }

                for (Map.Entry<String, Integer> entry : resultMap.entrySet()) {
                    log.info("大学生结果：{}-{}", entry.getKey(), entry.getValue());
                }
            }
        });

        return ResponseUtils.buildSuccessResponse(null);
    }

    @Override
    public BasePagingResponse<List<SoldierBasicOpenInfoDTO>> searchOpenBasicInfo(SoldierBasicInfoSearchRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        BizCheckUtil.checkNotBlank(request.getAuth(), "auth不能为空");

        String adminAreaCode = commonAuthInfoProvider.getAdminAreaCode(request.getAuth());
        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(request);
        soldierBasicInfoBSearcher.setAdminAreaCode(AdminAreaCodeUtils.getCutdAreaCode(adminAreaCode));
        final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.search(soldierBasicInfoBSearcher);
        List<SoldierBasicOpenInfoDTO> result = new ArrayList<>();
        for (SoldierBasicInfoDO basicInfoDO : soldierBasicInfoDOList) {
            SoldierBasicOpenInfoDTO item = new SoldierBasicOpenInfoDTO();
            BeanUtils.copyProperties(basicInfoDO, item);
            CommonAdminAreaDO commonAdminAreaDO = commonAdminAreaService.get(basicInfoDO.getResidentAdminAreaCode());
            if (commonAdminAreaDO != null) {
                item.setAdminAreaValue(commonAdminAreaDO.getFullValuePath());
            }
            item.setAdminAreaCode(basicInfoDO.getResidentAdminAreaCode());
            item.setHasQr(basicInfoDO.getSoldierId() == null ? false : true);
            result.add(item);
        }

        return ResponseUtils.buildSuccessPagingResponse(result, soldierBasicInfoBSearcher);
    }

    @Override
    public BasePagingResponse<List<SoldierBasicOpenInfoDTO>> searchOpenBasicInfo2(SoldierBasicInfoSearchRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");

        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(request);
        final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.search(soldierBasicInfoBSearcher);
        List<SoldierBasicOpenInfoDTO> result = new ArrayList<>();
        for (SoldierBasicInfoDO basicInfoDO : soldierBasicInfoDOList) {
            SoldierBasicOpenInfoDTO item = new SoldierBasicOpenInfoDTO();
            BeanUtils.copyProperties(basicInfoDO, item);
            CommonAdminAreaDO commonAdminAreaDO = commonAdminAreaService.get(basicInfoDO.getResidentAdminAreaCode());
            if (commonAdminAreaDO != null) {
                item.setAdminAreaValue(commonAdminAreaDO.getFullValuePath());
            }
            item.setAdminAreaCode(basicInfoDO.getResidentAdminAreaCode());
            result.add(item);
        }

        return ResponseUtils.buildSuccessPagingResponse(result, soldierBasicInfoBSearcher);
    }

    @Override
    public BasePagingResponse<List<SoldierBasicOpenInfoDTO>> searchElderlySoldier(SoldierBasicInfoSearchRequest request) {

        BizCheckUtil.checkNotNull(request, "请求不能为空");
        final SoldierBasicInfoBSearcher soldierBasicInfoBSearcher = SoldierBasicInfoProviderConverter.convertRequestSO2Searcher(request);
        Date date = org.apache.commons.lang3.time.DateUtils.addYears(new Date(), -60);
        soldierBasicInfoBSearcher.setBirthdayEnd(date);
        final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.searchElderlySoldier(soldierBasicInfoBSearcher);
        List<SoldierBasicOpenInfoDTO> result = new ArrayList<>();
        for (SoldierBasicInfoDO basicInfoDO : soldierBasicInfoDOList) {
            SoldierBasicOpenInfoDTO item = new SoldierBasicOpenInfoDTO();
            BeanUtils.copyProperties(basicInfoDO, item);
            result.add(item);
        }

        return ResponseUtils.buildSuccessPagingResponse(result, soldierBasicInfoBSearcher);
    }

    @Override
    public BaseResponse<JdlkInfoResponseDto> downLoad(SoldierBasicInfoSearchRequest soldierBasicInfoSearchRequest){
        String result="";
        //查询人员总数
//        Integer count=jdlkInfoBasicinfoDao.selectCount(soldierBasicInfoSearchRequest);
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        List<DimGjjdlkDoc> dicList=dimGjjdlkDocDao.queryAll();
        soldierBasicInfoSearchRequest.setStartTime1(sdf.format(soldierBasicInfoSearchRequest.getStartTime()));
        //查询前五百条数据
        List<JdlkInfoBasicinfo> jdlkInfoBasicinfoList=jdlkInfoBasicinfoDao.selectList(soldierBasicInfoSearchRequest);
        List<JdlkSoldierBasicInfo> last=new ArrayList<>();
        List<JdlkSoldierBasicInfo> jdlkSoldierBasicInfoList=new ArrayList<>();
        jdlkInfoBasicinfoList.stream().forEach(a->{
            JdlkSoldierBasicInfo jdlkSoldierBasicInfo=new JdlkSoldierBasicInfo();
            BeanUtils.copyProperties(a,jdlkSoldierBasicInfo);
            jdlkSoldierBasicInfoList.add(jdlkSoldierBasicInfo);
        });
        //将查询数据分成5组
        //按每100个一组分割
        List<List<JdlkSoldierBasicInfo>> parts = Lists.partition(jdlkSoldierBasicInfoList, 50);
        //查询其他字段信息
        CountDownLatch latch = new CountDownLatch(parts.size());
        for (int i = 0; i < parts.size(); i++) {
            int finalI = i;
            new Thread(() -> {
                List<JdlkSoldierBasicInfo> list=parts.get(finalI);
                queryDetailInfo(list);
                convert(list,dicList);
                last.addAll(list);
                System.out.println("第"+finalI+"组结束");
                latch.countDown();
            }).start();

        }
        try {
            latch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        JdlkInfoResponseDto jdlkInfoResponseDto=new JdlkInfoResponseDto();
        if(500>jdlkInfoBasicinfoList.size()){
            jdlkInfoResponseDto.setIfEnd(1);
        }else {
            jdlkInfoResponseDto.setIfEnd(0);
        }
        String listJSONString = JSON.toJSONString(last);
        result=Sm4Util.encryptSm4(listJSONString);
        jdlkInfoResponseDto.setInfoList(result);
        return ResponseUtils.buildSuccessResponse(jdlkInfoResponseDto);
    }

    @Override
    public BaseResponse<SoldierBasicInfoDTO> getSoldierBasicInfoByCard_basicDb(String idCardNo) {
        BizCheckUtil.checkIDCardNO(idCardNo);

        SoldierBasicInfoDO soldierBasicInfoDO = soldierBasicInfoService.getByIdCardNo_basicDb(idCardNo);

        ThreadPoolManager.getInstance().execute(new Runnable() {
            @Override
            public void run() {
                // TODO
//                checkAndSetAvatarPath(soldierBasicInfoDO);
            }
        });

        SoldierBasicInfoDTO soldierBasicInfoDTO = SoldierBasicInfoProviderConverter.convertResponseDO2DTO(soldierBasicInfoDO);
        if (soldierBasicInfoDTO == null) {
            return new BaseResponse<>(true, soldierBasicInfoDTO);
        }


        int warningLevel = 0;
        List<SoldierDifficultyRegistrationInfoDO> umemploymentInfo = soldierDifficultyRegistrationInfoService.getByIdCardNo(soldierBasicInfoDTO.getIdCardNo());
        if (!CollectionUtils.isEmpty(umemploymentInfo)) {
            warningLevel++;
        }
        List<SoldierUnemploymentRegistrationInfoDO> difficultyInfo = soldierUnemploymentRegistrationInfoService.getByIdCardNo(soldierBasicInfoDTO.getIdCardNo());
        if (!CollectionUtils.isEmpty(difficultyInfo)) {
            warningLevel++;
        }
        soldierBasicInfoDTO.setWarningLevel(String.valueOf(warningLevel));
        return new BaseResponse<>(true, soldierBasicInfoDTO);
    }

    @Override
    public BaseResponse<Boolean> updateSoldierBasicInformation(SoldierBasicInformationUpdateRequest request) {
        //校验ID
        //修改采集信息
        BasicInformationDO basicInformationDO = new BasicInformationDO();
        BeanUtils.copyProperties(request, basicInformationDO);
        basicInformationDO.setId(Long.valueOf(request.getId()));
        int i = basicInformationDAO.updateByPrimaryKeySelective(basicInformationDO);
        return ResponseUtils.buildSuccessResponse(true);
    }

    public void queryDetailInfo(List<JdlkSoldierBasicInfo> origion){
        List<String> idList=origion.stream().map(a->a.getIdCardNum()).collect(Collectors.toList());
        List<JdlkSoldierBasicInfo> list1=jdlkInfoBasicinfoDao.queryDetailInfo1(idList);
        list1.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
        List<JdlkSoldierBasicInfo> list2=jdlkInfoBasicinfoDao.queryDetailInfo2(idList);
        list2.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
        List<JdlkSoldierBasicInfo> list3=jdlkInfoBasicinfoDao.queryDetailInfo3(idList);
        list3.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
        List<JdlkSoldierBasicInfo> list4=jdlkInfoBasicinfoDao.queryDetailInfo4(idList);
        list4.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
        List<JdlkSoldierBasicInfo> list5=jdlkInfoBasicinfoDao.queryDetailInfo5(idList);
        list5.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
        List<JdlkSoldierBasicInfo> list6=jdlkInfoBasicinfoDao.queryDetailInfo6(idList);
        list6.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
        List<JdlkSoldierBasicInfo> list7=jdlkInfoBasicinfoDao.queryDetailInfo7(idList);
        list7.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
        List<JdlkSoldierBasicInfo> list8=jdlkInfoBasicinfoDao.queryDetailInfo8(idList);
        list8.stream().forEach(a->{
            origion.stream().forEach(b->{
                if(a.getIdCardNum().equals(b.getIdCardNum())){
                    BeanUtil.copyProperties(a, b, CopyOptions.create().setIgnoreNullValue(true));
                }
            });
        });
    }

    public void  convert(List<JdlkSoldierBasicInfo> list, List<DimGjjdlkDoc> origion){
        list.stream().forEach(a->{
            if(!StringUtils.isEmpty(a.getDocuType())){
                List<DimGjjdlkDoc>  dicList=origion.stream().filter(b->"证件类型".equals(b.getLy())&&a.getDocuType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setDocuType(CollectionUtils.isEmpty(dicList)?"":dicList.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getPerCateOneLev())){
                List<DimGjjdlkDoc>  dicList1=origion.stream().filter(b->"人员类别大类".equals(b.getLy())&&a.getPerCateOneLev().equals(b.getBzdm())).collect(Collectors.toList());
                a.setPerCateOneLev(CollectionUtils.isEmpty(dicList1)?"":dicList1.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getPerCateTwoLev())){
                List<DimGjjdlkDoc>  dicList2=origion.stream().filter(b->"军人类别".equals(b.getLy())&&a.getPerCateTwoLev().equals(b.getBzdm())).collect(Collectors.toList());
                a.setPerCateTwoLev(CollectionUtils.isEmpty(dicList2)?"":dicList2.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getResDuty())){
                List<DimGjjdlkDoc>  dicList3=origion.stream().filter(b->"预备役情况".equals(b.getLy())&&a.getResDuty().equals(b.getBzdm())).collect(Collectors.toList());
                a.setResDuty(CollectionUtils.isEmpty(dicList3)?"":dicList3.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getRetCerType())){
                List<DimGjjdlkDoc>  dicList4=origion.stream().filter(b->"退役证件类型".equals(b.getLy())&&a.getRetCerType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setRetCerType(CollectionUtils.isEmpty(dicList4)?"":dicList4.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getAssiResu())){
                List<DimGjjdlkDoc>  dicList5=origion.stream().filter(b->"帮扶结果".equals(b.getLy())&&a.getAssiResu().equals(b.getBzdm())).collect(Collectors.toList());
                a.setAssiResu(CollectionUtils.isEmpty(dicList5)?"":dicList5.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getDiffType())){
                List<DimGjjdlkDoc>  dicList6=origion.stream().filter(b->"困难类型".equals(b.getLy())&&a.getDiffType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setDiffType(CollectionUtils.isEmpty(dicList6)?"":dicList6.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getIllneDeaSoldRela())){
                List<DimGjjdlkDoc>  dicList7=origion.stream().filter(b->"与病故军人关系".equals(b.getLy())&&a.getIllneDeaSoldRela().equals(b.getBzdm())).collect(Collectors.toList());
                a.setIllneDeaSoldRela(CollectionUtils.isEmpty(dicList7)?"":dicList7.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getCatPreObject())){
                List<DimGjjdlkDoc>  dicList8=origion.stream().filter(b->"优抚待遇对象类别".equals(b.getLy())&&a.getCatPreObject().equals(b.getBzdm())).collect(Collectors.toList());
                a.setCatPreObject(CollectionUtils.isEmpty(dicList8)?"":dicList8.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getEnjoyPreTreat())){
                List<DimGjjdlkDoc>  dicList9=origion.stream().filter(b->"享受优抚待遇情况".equals(b.getLy())&&a.getEnjoyPreTreat().equals(b.getBzdm())).collect(Collectors.toList());
                a.setEnjoyPreTreat(CollectionUtils.isEmpty(dicList9)?"":dicList9.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getSupportStatu())){
                List<DimGjjdlkDoc>  dicList10=origion.stream().filter(b->"供养情况".equals(b.getLy())&&a.getSupportStatu().equals(b.getBzdm())).collect(Collectors.toList());
                a.setSupportStatu(CollectionUtils.isEmpty(dicList10)?"":dicList10.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getSupportUnit())){
                List<DimGjjdlkDoc>  dicList11=origion.stream().filter(b->"供养单位".equals(b.getLy())&&a.getSupportUnit().equals(b.getBzdm())).collect(Collectors.toList());
                a.setSupportUnit(CollectionUtils.isEmpty(dicList11)?"":dicList11.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getSolOldStatu())){
                List<DimGjjdlkDoc>  dicList12=origion.stream().filter(b->"孤老情况".equals(b.getLy())&&a.getSolOldStatu().equals(b.getBzdm())).collect(Collectors.toList());
                a.setSolOldStatu(CollectionUtils.isEmpty(dicList12)?"":dicList12.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getWheTheOrphan())){
                List<DimGjjdlkDoc>  dicList13=origion.stream().filter(b->"孤儿情况".equals(b.getLy())&&a.getWheTheOrphan().equals(b.getBzdm())).collect(Collectors.toList());
                a.setWheTheOrphan(CollectionUtils.isEmpty(dicList13)?"":dicList13.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getMartRela())){
                List<DimGjjdlkDoc>  dicList14=origion.stream().filter(b->"与烈士关系".equals(b.getLy())&&a.getMartRela().equals(b.getBzdm())).collect(Collectors.toList());
                a.setMartRela(CollectionUtils.isEmpty(dicList14)?"":dicList14.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getOnDutSacrifSoldRela())){
                List<DimGjjdlkDoc>  dicList15=origion.stream().filter(b->"与因公牺牲军人关系".equals(b.getLy())&&a.getOnDutSacrifSoldRela().equals(b.getBzdm())).collect(Collectors.toList());
                a.setOnDutSacrifSoldRela(CollectionUtils.isEmpty(dicList15)?"":dicList15.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getSecEnlist())){
                List<DimGjjdlkDoc>  dicList16=origion.stream().filter(b->"二次入伍情况".equals(b.getLy())&&a.getSecEnlist().equals(b.getBzdm())).collect(Collectors.toList());
                a.setSecEnlist(CollectionUtils.isEmpty(dicList16)?"":dicList16.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getSerArmyWinHonGrade())){
                List<DimGjjdlkDoc>  dicList17=origion.stream().filter(b->"服役时立功受奖奖项".equals(b.getLy())&&a.getSerArmyWinHonGrade().equals(b.getBzdm())).collect(Collectors.toList());
                a.setSerArmyWinHonGrade(CollectionUtils.isEmpty(dicList17)?"":dicList17.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getSerArmyWinHonGradeType())){
                List<DimGjjdlkDoc>  dicList18=origion.stream().filter(b->"服役时处分".equals(b.getLy())&&a.getSerArmyWinHonGradeType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setSerArmyWinHonGradeType(CollectionUtils.isEmpty(dicList18)?"":dicList18.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getCatOffiCad())){
                List<DimGjjdlkDoc>  dicList19=origion.stream().filter(b->"干部类别".equals(b.getLy())&&a.getCatOffiCad().equals(b.getBzdm())).collect(Collectors.toList());
                a.setCatOffiCad(CollectionUtils.isEmpty(dicList19)?"":dicList19.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getOffiType())){
                List<DimGjjdlkDoc>  dicList20=origion.stream().filter(b->"军官类别".equals(b.getLy())&&a.getOffiType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setOffiType(CollectionUtils.isEmpty(dicList20)?"":dicList20.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getCivCadType())){
                List<DimGjjdlkDoc>  dicList21=origion.stream().filter(b->"文职干部类别".equals(b.getLy())&&a.getCivCadType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setCivCadType(CollectionUtils.isEmpty(dicList21)?"":dicList21.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getEndowInsuInterrupted())){
                a.setEndowInsuInterrupted("0".equals(a.getEndowInsuInterrupted())?"是":"否");
            }

            if(!StringUtils.isEmpty(a.getMedInsuInterrupted())){
                a.setMedInsuInterrupted("0".equals(a.getMedInsuInterrupted())?"是":"否");
            }
            if(!StringUtils.isEmpty(a.getHousStatu())){
                List<DimGjjdlkDoc>  dicList22=origion.stream().filter(b->"住房情况".equals(b.getLy())&&a.getHousStatu().equals(b.getBzdm())).collect(Collectors.toList());
                a.setHousStatu(CollectionUtils.isEmpty(dicList22)?"":dicList22.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getPayHousFund())){
                List<DimGjjdlkDoc>  dicList23=origion.stream().filter(b->"住房公积金缴纳情况".equals(b.getLy())&&a.getPayHousFund().equals(b.getBzdm())).collect(Collectors.toList());
                a.setPayHousFund(CollectionUtils.isEmpty(dicList23)?"":dicList23.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getTrainingType())){
                List<DimGjjdlkDoc>  dicList24=origion.stream().filter(b->"培训类型".equals(b.getLy())&&a.getTrainingType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setTrainingType(CollectionUtils.isEmpty(dicList24)?"":dicList24.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getPartTrain())){
                List<DimGjjdlkDoc>  dicList25=origion.stream().filter(b->"参加培训情况".equals(b.getLy())&&a.getPartTrain().equals(b.getBzdm())).collect(Collectors.toList());
                a.setPartTrain(CollectionUtils.isEmpty(dicList25)?"":dicList25.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getCertiQuali())){
                List<DimGjjdlkDoc>  dicList26=origion.stream().filter(b->"获取证书情况".equals(b.getLy())&&a.getCertiQuali().equals(b.getBzdm())).collect(Collectors.toList());
                a.setCertiQuali(CollectionUtils.isEmpty(dicList26)?"":dicList26.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getPostVilCadRetSold())){
                List<DimGjjdlkDoc>  dicList27=origion.stream().filter(b->"退役军人村干部职务".equals(b.getLy())&&a.getPostVilCadRetSold().equals(b.getBzdm())).collect(Collectors.toList());
                a.setPostVilCadRetSold(CollectionUtils.isEmpty(dicList27)?"":dicList27.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getSocPosRetVilCad())){
                List<DimGjjdlkDoc>  dicList28=origion.stream().filter(b->"社会职务".equals(b.getLy())&&a.getSocPosRetVilCad().equals(b.getBzdm())).collect(Collectors.toList());
                a.setSocPosRetVilCad(CollectionUtils.isEmpty(dicList28)?"":dicList28.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getComRetVilCadDurTen())){
                List<DimGjjdlkDoc>  dicList29=origion.stream().filter(b->"任期内受表彰情况".equals(b.getLy())&&a.getComRetVilCadDurTen().equals(b.getBzdm())).collect(Collectors.toList());
                a.setComRetVilCadDurTen(CollectionUtils.isEmpty(dicList29)?"":dicList29.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getAdvSpeRetVilCad())){
                List<DimGjjdlkDoc>  dicList30=origion.stream().filter(b->"优势特长".equals(b.getLy())&&a.getAdvSpeRetVilCad().equals(b.getBzdm())).collect(Collectors.toList());
                a.setAdvSpeRetVilCad(CollectionUtils.isEmpty(dicList30)?"":dicList30.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getCharacIndustry())){
                List<DimGjjdlkDoc>  dicList31=origion.stream().filter(b->"特色产业".equals(b.getLy())&&a.getCharacIndustry().equals(b.getBzdm())).collect(Collectors.toList());
                a.setCharacIndustry(CollectionUtils.isEmpty(dicList31)?"":dicList31.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getRecogLev())){
                List<DimGjjdlkDoc>  dicList32=origion.stream().filter(b->"表彰级别".equals(b.getLy())&&a.getRecogLev().equals(b.getBzdm())).collect(Collectors.toList());
                a.setRecogLev(CollectionUtils.isEmpty(dicList32)?"":dicList32.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getCommendation())){
                List<DimGjjdlkDoc>  dicList33=origion.stream().filter(b->"表彰事项".equals(b.getLy())&&a.getCommendation().equals(b.getBzdm())).collect(Collectors.toList());
                a.setCommendation(CollectionUtils.isEmpty(dicList33)?"":dicList33.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getEduBack())){
                List<DimGjjdlkDoc>  dicList34=origion.stream().filter(b->"学历情况".equals(b.getLy())&&a.getEduBack().equals(b.getBzdm())).collect(Collectors.toList());
                a.setEduBack(CollectionUtils.isEmpty(dicList34)?"":dicList34.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getDegreeInfor())){
                List<DimGjjdlkDoc>  dicList35=origion.stream().filter(b->"学位情况".equals(b.getLy())&&a.getDegreeInfor().equals(b.getBzdm())).collect(Collectors.toList());
                a.setDegreeInfor(CollectionUtils.isEmpty(dicList35)?"":dicList35.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getTheHangOfGloCard())){
                List<DimGjjdlkDoc>  dicList36=origion.stream().filter(b->"光荣牌悬挂情况".equals(b.getLy())&&a.getTheHangOfGloCard().equals(b.getBzdm())).collect(Collectors.toList());
                a.setTheHangOfGloCard(CollectionUtils.isEmpty(dicList36)?"":dicList36.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getSlaWheCancel())){
                a.setSlaWheCancel("0".equals(a.getSlaWheCancel())?"是":"否");
            }

            if(!StringUtils.isEmpty(a.getSlaWheUpd())){
                a.setSlaWheUpd("0".equals(a.getSlaWheUpd())?"是":"否");
            }
            if(!StringUtils.isEmpty(a.getPost())){
                List<DimGjjdlkDoc>  dicList37=origion.stream().filter(b->"职务".equals(b.getLy())&&a.getPost().equals(b.getBzdm())).collect(Collectors.toList());
                a.setPost(CollectionUtils.isEmpty(dicList37)?"":dicList37.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getHoldSitua())){
                List<DimGjjdlkDoc>  dicList38=origion.stream().filter(b->"控股情况".equals(b.getLy())&&a.getHoldSitua().equals(b.getBzdm())).collect(Collectors.toList());
                a.setHoldSitua(CollectionUtils.isEmpty(dicList38)?"":dicList38.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getInduEnterprise())){
                List<DimGjjdlkDoc>  dicList39=origion.stream().filter(b->"所属行业代码".equals(b.getLy())&&a.getInduEnterprise().equals(b.getBzdm())).collect(Collectors.toList());
                a.setInduEnterprise(CollectionUtils.isEmpty(dicList39)?"":dicList39.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getGoToCountryEntre())){
                List<DimGjjdlkDoc>  dicList40=origion.stream().filter(b->"下（返）乡创业".equals(b.getLy())&&a.getGoToCountryEntre().equals(b.getBzdm())).collect(Collectors.toList());
                a.setGoToCountryEntre(CollectionUtils.isEmpty(dicList40)?"":dicList40.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getLaborCapacity())){
                List<DimGjjdlkDoc>  dicList41=origion.stream().filter(b->"劳动能力".equals(b.getLy())&&a.getLaborCapacity().equals(b.getBzdm())).collect(Collectors.toList());
                a.setLaborCapacity(CollectionUtils.isEmpty(dicList41)?"":dicList41.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getAbilityLive())){
                List<DimGjjdlkDoc>  dicList42=origion.stream().filter(b->"生活能力".equals(b.getLy())&&a.getAbilityLive().equals(b.getBzdm())).collect(Collectors.toList());
                a.setAbilityLive(CollectionUtils.isEmpty(dicList42)?"":dicList42.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getDisaCate())){
                List<DimGjjdlkDoc>  dicList43=origion.stream().filter(b->"残疾性质".equals(b.getLy())&&a.getDisaCate().equals(b.getBzdm())).collect(Collectors.toList());
                a.setDisaCate(CollectionUtils.isEmpty(dicList43)?"":dicList43.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getDisaGrade())){
                List<DimGjjdlkDoc>  dicList44=origion.stream().filter(b->"残疾等级".equals(b.getLy())&&a.getDisaGrade().equals(b.getBzdm())).collect(Collectors.toList());
                a.setDisaGrade(CollectionUtils.isEmpty(dicList44)?"":dicList44.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getPreSerEdu())){
                List<DimGjjdlkDoc>  dicList45=origion.stream().filter(b->"服役前在读学历".equals(b.getLy())&&a.getPreSerEdu().equals(b.getBzdm())).collect(Collectors.toList());
                a.setPreSerEdu(CollectionUtils.isEmpty(dicList45)?"":dicList45.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getEduBackBeforeRet())){
                List<DimGjjdlkDoc>  dicList46=origion.stream().filter(b->"学历情况".equals(b.getLy())&&a.getEduBackBeforeRet().equals(b.getBzdm())).collect(Collectors.toList());
                a.setEduBackBeforeRet(CollectionUtils.isEmpty(dicList46)?"":dicList46.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getDegreeInforBeforeRet())){
                List<DimGjjdlkDoc>  dicList47=origion.stream().filter(b->"学位情况".equals(b.getLy())&&a.getDegreeInforBeforeRet().equals(b.getBzdm())).collect(Collectors.toList());
                a.setDegreeInforBeforeRet(CollectionUtils.isEmpty(dicList47)?"":dicList47.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getIsVeteran())){
                a.setIsVeteran("1".equals(a.getIsVeteran())?"退役军人":"其他优抚对象");
            }
            if(!StringUtils.isEmpty(a.getDocuType())){
                List<DimGjjdlkDoc>  dicList48=origion.stream().filter(b->"性别".equals(b.getLy())&&a.getDocuType().equals(b.getBzdm())).collect(Collectors.toList());
                a.setDocuType(CollectionUtils.isEmpty(dicList48)?"":dicList48.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getNationality())){
                List<DimGjjdlkDoc>  dicList49=origion.stream().filter(b->"民族".equals(b.getLy())&&a.getNationality().equals(b.getBzdm())).collect(Collectors.toList());
                a.setNationality(CollectionUtils.isEmpty(dicList49)?"":dicList49.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getHealStatu())){
                List<DimGjjdlkDoc>  dicList50=origion.stream().filter(b->"健康状况".equals(b.getLy())&&a.getHealStatu().equals(b.getBzdm())).collect(Collectors.toList());
                a.setHealStatu(CollectionUtils.isEmpty(dicList50)?"":dicList50.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getHouseRegisCate())){
                List<DimGjjdlkDoc>  dicList51=origion.stream().filter(b->"户籍类别".equals(b.getLy())&&a.getHouseRegisCate().equals(b.getBzdm())).collect(Collectors.toList());
                a.setHouseRegisCate(CollectionUtils.isEmpty(dicList51)?"":dicList51.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getEmployment())){
                List<DimGjjdlkDoc>  dicList52=origion.stream().filter(b->"就业状态".equals(b.getLy())&&a.getEmployment().equals(b.getBzdm())).collect(Collectors.toList());
                a.setEmployment(CollectionUtils.isEmpty(dicList52)?"":dicList52.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getMarStatu())){
                List<DimGjjdlkDoc>  dicList53=origion.stream().filter(b->"婚姻状况".equals(b.getLy())&&a.getMarStatu().equals(b.getBzdm())).collect(Collectors.toList());
                a.setMarStatu(CollectionUtils.isEmpty(dicList53)?"":dicList53.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getEnjoyPolGua())){
                List<DimGjjdlkDoc>  dicList54=origion.stream().filter(b->"享受政策情况".equals(b.getLy())&&a.getEnjoyPolGua().equals(b.getBzdm())).collect(Collectors.toList());
                a.setEnjoyPolGua(CollectionUtils.isEmpty(dicList54)?"":dicList54.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getMilRestCate())){
                List<DimGjjdlkDoc>  dicList55=origion.stream().filter(b->"军休类别".equals(b.getLy())&&a.getMilRestCate().equals(b.getBzdm())).collect(Collectors.toList());
                a.setMilRestCate(CollectionUtils.isEmpty(dicList55)?"":dicList55.get(0).getBzmc());
            }


            if(!StringUtils.isEmpty(a.getWhePartyMemDuesTime())){
                a.setWhePartyMemDuesTime("0".equals(a.getWhePartyMemDuesTime())?"否":"是");
            }

            if(!StringUtils.isEmpty(a.getWheToPostPartOrgan())){
                a.setWheToPostPartOrgan("0".equals(a.getWheToPostPartOrgan())?"否":"是");
            }

            if(!StringUtils.isEmpty(a.getIsOutOrgan())){
                a.setIsOutOrgan("0".equals(a.getIsOutOrgan())?"否":"是");
            }

            if(!StringUtils.isEmpty(a.getResetType())){
                a.setResetType("1".equals(a.getResetType())?"退役安置":"军休安置");
            }
            if(!StringUtils.isEmpty(a.getRetirResetUnitNature())){
                List<DimGjjdlkDoc>  dicList56=origion.stream().filter(b->"安置单位性质".equals(b.getLy())&&a.getRetirResetUnitNature().equals(b.getBzdm())).collect(Collectors.toList());
                a.setRetirResetUnitNature(CollectionUtils.isEmpty(dicList56)?"":dicList56.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getRetirResetPosRan())){
                List<DimGjjdlkDoc>  dicList57=origion.stream().filter(b->"安置职务级别".equals(b.getLy())&&a.getRetirResetPosRan().equals(b.getBzdm())).collect(Collectors.toList());
                a.setRetirResetPosRan(CollectionUtils.isEmpty(dicList57)?"":dicList57.get(0).getBzmc());
            }

            if(!StringUtils.isEmpty(a.getInduLibPro())){
                List<DimGjjdlkDoc>  dicList58=origion.stream().filter(b->"所属行业代码".equals(b.getLy())&&a.getInduLibPro().equals(b.getBzdm())).collect(Collectors.toList());
                a.setInduLibPro(CollectionUtils.isEmpty(dicList58)?"":dicList58.get(0).getBzmc());
            }

        });

    }
    private Date stringToDate(String birthdayStr) {
        if (Strings.isBlank(birthdayStr)) {
            return null;
        }
        try {
            DateTime yyyMMdd = DateUtil.parse(birthdayStr, "yyyyMMdd");
            return yyyMMdd.toJdkDate();
        } catch (Exception e) {
            log.error("转换日期错误：{}", e);
        }
        return null;
    }

    private String optSoldierType(String soldierType) {
        if (Strings.isBlank(soldierType)) {
            return "";
        }
        soldierType = soldierType.replace("，", ",");
        return soldierType.trim();
    }

    private String getSoldierTypeCodes(String soldierType) {
        if (Strings.isBlank(soldierType)) {
            return "";
        }
        List<String> code = Lists.newArrayList();
        Map<String, String> name2TitleMap = SoldierTypeEnum.getName2TitleMap();

        soldierType = soldierType.replace("，", ",");
        for (String s : soldierType.split(",")) {
            for (String key : name2TitleMap.keySet()) {
                if (name2TitleMap.get(key).equals(s)) {
                    code.add(key);
                }
            }
        }
        return String.join(",", code);
    }

    private List<SoldierBasicImportDO> getUniSoldiers(List<SoldierBasicImportDO> soldierBasicImportDOS) {
        List<SoldierBasicImportDO> result = Lists.newArrayList();
        Set<String> idSet = Sets.newHashSet();
        for (SoldierBasicImportDO soldierBasicImportDO : soldierBasicImportDOS) {
            if (!idSet.contains(soldierBasicImportDO.getIdCardNo())) {
                result.add(soldierBasicImportDO);
                idSet.add(soldierBasicImportDO.getIdCardNo());
            }
        }
        return result;
    }


    @Override
    public BaseResponse<Map<String, SoldierBasicInfoDTO>> getSoldierId2ObjMapByIdList(final List<String> idList) {


        final BaseResponse<Map<String, SoldierBasicInfoDTO>> baseResponse = new BaseResponse<>();
        serviceTemplate.execute(baseResponse, new ServiceCallback() {
            @Override
            public void check() {
                BizCheckUtil.checkIsTrue(!CollectionUtils.isEmpty(idList), "id集合不能为空");
            }

            @Override
            public void executeService() {
                final List<SoldierBasicInfoDO> soldierBasicInfoDOList = soldierBasicInfoService.listByIdList(idList);
                if (!CollectionUtils.isEmpty(soldierBasicInfoDOList)) {
                    final Map<String, SoldierBasicInfoDTO> id2ClassMap = new HashMap<>(soldierBasicInfoDOList.size());
                    for (SoldierBasicInfoDO soldierBasicInfoDO : soldierBasicInfoDOList) {
                        id2ClassMap.put(soldierBasicInfoDO.getId(), SoldierBasicInfoProviderConverter.convertResponseDO2DTO(soldierBasicInfoDO));
                    }
                    ResponseUtils.setupSuccessResponse(baseResponse, id2ClassMap);
                } else {
                    ResponseUtils.setupSuccessResponse(baseResponse, Collections.emptyMap());
                }
            }

            @Override
            public ScenarioCodeEnum getScenarioEnum() {
                return ScenarioCodeEnum.GET_SOLDIER_BASIC_INFO_ID2OBJ_MAPPING_BY_ID_LIST;
            }
        });

        return baseResponse;
    }

}
